Betweenness Example | Teradata Vantage - Betweenness Example - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

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.