Closeness Example 1: Unweighted, Unbounded Graph - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantage™

Input

Input tables are from AllPairsShortestPath Example 1: 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')
  MaxDistance (-1)
  Accumulate ('callerid', 'callername')
) AS dt ORDER BY callerid;

Output

Because callerid 6 (Diana) has no outbound calls, the k-degree is 0.

callerid callername inv_sum_dist inv_avg_dist sum_inv_dist kdegree
1 John 0.25 1 4 4
2 Carla 0.5 1 2 2
3 Simon 1 1 1 1
4 Celine 1 1 1 1
5 Winston 1 1 1 1
6 Diana       0