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
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.649450550239096 |
D | 0.528366549347061 |
A | 0.418290184899757 |
B | 0.352244366231374 |