1.1 - 8.10 - Closeness Example: Weighted, Bounded Graph, MaxDistance=12 - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

Input

Input tables are from AllPairsShortestPath Example: Unweighted, Unbounded Graph:

  • Vertices: callers
  • Edges: calls

SQL Call

SELECT * FROM Closeness (
  ON callers AS Vertices PARTITION BY callerid
  ON calls AS Edges PARTITION BY callerfrom
  USING
  TargetKey ('callerto')
  EdgeWeight ('calls')
  MaxDistance (12)
  Accumulate ('callerid', 'callername')
) AS dt ORDER BY callerid;

Output

 callerid callername inv_sum_dist        inv_avg_dist       sum_inv_dist        kdegree 
 -------- ---------- ------------------- ------------------ ------------------- ------- 
        1 john                      0.05                0.2  1.1333333333333333     4.0
        2 carla      0.05555555555555555 0.1111111111111111 0.23376623376623376     2.0
        3 simon                      1.0                1.0                 1.0     1.0
        4 celine                    0.25               0.25                0.25     1.0
        5 winston                    0.1                0.1                 0.1     1.0
        6 diana                     NULL               NULL                NULL     0.0

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.