1.1 - 8.10 - Betweenness Example - 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)

This example computes the betweenness score for each person in the social network shown in the following figure.

Betweenness Example Social Network
Graph of input for example of Machine Learning Engine function Betweenness on unweighted, unbounded graph

Input

The Vertices table has the names of people. The Edges table represents the connections between the people.

Vertices: soc_nw_vertices
vertexid
TED
RICKY
ETHEL
FRED
JOE
RANDY
LUCY
Edges: soc_nw_edges
source target
TED ETHEL
RICKY FRED
ETHEL LUCY
ETHEL RANDY
FRED ETHEL
ETHEL FRED
JOE ETHEL
RANDY RICKY
RICKY RANDY
FRED LUCY

SQL Call

SELECT * FROM Betweenness (
  ON soc_nw_vertices AS Vertices PARTITION BY vertexid
  ON soc_nw_edges AS Edges PARTITION BY source
  USING
  TargetKey ('target')
  Accumulate ('vertexid')
) AS dt ORDER BY vertexid;

Output

Ethel has the highest betweenness score.

 vertexid betweenness 
 -------- ----------- 
 ethel           10.0
 fred             4.0
 joe              0.0
 lucy             0.0
 randy            4.0
 ricky            3.0
 ted              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.