Input
In the following figure, nodes represent college sophomores and edges represent the number of elective subjects that both sophomores have taken.
EigenvectorCentrality Examples Input Graph
The graph in the figure is represented by the Vertices and Edges tables sophomores and common_classes, respectively.
id | name |
---|---|
A | Allen |
B | Becky |
C | Cathy |
D | Darren |
startid | endid | electives |
---|---|---|
A | B | 1 |
A | C | 1 |
B | C | 1 |
C | D | 1 |
D | A | 1 |
SQL Call
Family is 'eigenVector' by default.
SELECT * FROM EigenvectorCentrality ( ON sophomores AS Vertices PARTITION BY id ON common_classes AS Edges PARTITION BY startid USING TargetKey ('endid') Accumulate ('id') EdgeWeight ('electives') ) AS dt ORDER BY centrality DESC;
Output
id centrality -- ------------------- c 0.6494505502390958 b 0.35224436623137406 d 0.5283665493470611 a 0.41829018489975667
Download a zip file of all examples and a SQL script file that creates their input tables.