UltipaDocs
Try Playground
  • Introduction
    • Show Algorithms
    • Install and Uninstall
    • Run Algorithms
    • Algorithm Results and Statistics
    • Degree Centrality
    • Closeness Centrality
    • Harmonic Centrality
    • Graph Centrality
    • Betweenness Centrality
    • Eigenvector Centrality
    • CELF
    • PageRank
    • ArticleRank
    • HITS
    • SybilRank
    • Jaccard Similarity
    • Overlap Similarity
    • Cosine Similarity
    • Pearson Correlation Coefficient
    • Euclidean Distance
    • K-Hop All
    • Bipartite Graph
    • HyperANF
    • Connected Component
    • Triangle Counting
    • Induced Subgraph
    • k-Core
    • k-Truss
    • p-Cohesion
    • k-Edge Connected Components
    • Local Clustering Coefficient
    • Topological Sort
    • Schema Overview
    • Dijkstra's Single-Source Shortest Path
    • Delta-Stepping Single-Source Shortest Path
    • Shortest Path Faster Algorithm (SPFA)
    • Minimum Spanning Tree
    • Breadth-First Search (BFS)
    • Depth-First Search (DFS)
    • Adamic-Adar Index
    • Common Neighbors
    • Preferential Attachment
    • Resource Allocation
    • Total Neighbors
    • Louvain
    • Leiden
    • Label Propagation
    • HANP
    • k-Means
    • kNN (k-Nearest Neighbors)
    • K-1 Coloring
    • Conductance
      • Random Walk
      • Node2Vec Walk
      • Node2Vec
      • Struc2Vec Walk
      • Struc2Vec
      • GraphSAGE
      • GraphSAGE Train
      • LINE
      • Fast Random Projection
      • Summary of Graph Embedding
      • Gradient Descent
      • Backpropagation
      • Skip-gram
      • Skip-gram Optimization
  1. Docs
  2. /
  3. Graph Analytics & Algorithms
  4. /
  5. Centrality

Eigenvector Centrality

✓ File Writeback ✓ Property Writeback ✓ Direct Return ✓ Stream Return ✕ Stats

Overview

Eigenvector centrality measures the power or influence of a node. In a directed network, the power of a node comes from its incoming neighbors. Thus, the eigenvector centrality score of a node depends not only on how many in-links it has, but also on how powerful its incoming neighbors are. Connections from high-scoring nodes contribute more to the score of the node than connections from low-scoring nodes. In the disease spreading scenario, a node with higher eigenvector centrality is more likely to be close to the source of infection, which needs special precautions.

The well-known PageRank is a variant of eigenvector centrality.

Eigenvector centrality takes on values between 0 to 1, nodes with higher scores are more influential in the network.

Concepts

Eigenvector Centrality

The power (score) of each node can be computed in a recursive way. Take the graph below as as example, adjacent matrix A reflects the in-links of each node. Initialzing that each node has score of 1 and it is represented by vector s(0).

In each round of power transition, update the score of each node by the sum of scores of all its incoming neighbors. After one round, vector s(1) = As(0) is as follows, L2-normalization is applied to rescale:

After k iterations, s(k) = As(k-1) = Aks(0). As k grows, s(k) stabilizes. In this example, the stablization is reached after ~20 rounds.

In fact, s(k) converges to the eigenvector of matrix A that corresponds to the largest absolute eigenvalue, hence elements in s(k) is referred to as eigenvector centrality.

Eigenvalue and Eigenvector

Given A is an n x n square matrix, λ is a constant, x is an non-zero n x 1 vector. If the equation Ax = λx is true, then λ is called the eigenvalue of A, and x is the eigenvector of A that corresponds to the eigenvalue λ.

The above matrix A has 4 eigenvalues λ1, λ2, λ3 and λ4 that correspond to eigenvectors x1, x2, x3 and x4 respectively. x1 is the eigenvector corresponding to the dominate eigenvalue λ1 that has the largtest absolute value.

According to the Perron-Forbenius theorem, if matrix A has eigenvalues |λ1| > |λ2| ≥ |λ3| ≥ ... ≥ |λn|, as k → ∞, the direction of s(k) = Aks(0) converges to x1, and s(0) can be any nonzero vector.

Power Iteration

For the best computation efficiency and accuracy, this algorithm adopts the power iteration approach to compute the dominate eigenvector (x1) of matrix A:

  • s(1) = As(0)
  • s(2) = As(1) = A2s(0)
  • ...
  • s(k) = As(k-1) = Aks(0)

The algorithm continues until s(k) converges to within some tolerance, or the maximum iteration rounds is met.

Considerations

  • The algorithm uses the sum of adjacency matrix and unit matrix (i.e., A = A + I) rather than the adjacency matrix only in order to guarantee the covergence.
  • The eigenvector centrality score of nodes with no in-link converges to 0.
  • Self-loop is counted as one in-link, its weight counted only once (weighted graph).

Syntax

  • Command: algo(eigenvector_centrality)
  • Parameters:
Name
Type
Spec
Default
Optional
Description
max_loop_numint≥120YesMaximum rounds of iterations; the algorithm ends after running for all rounds, even though the condition of tolerance is not met
tolerancefloat(0,1)0.001YesWhen all scores change less than the tolerance between iterations, the result is considered stable and the algorithm ends
edge_weight_property@<schema>?.<property>Numeric type, must LTE/YesEdge property(-ies) to use as edge weight(s), where the values of multiple properties are summed up
directionstringin, out/YesConstructs the adjacent matrix A with the in-links (in) or our-links (out) of each node
limitint≥-1-1YesNumber of results to return, -1 to return all results
orderstringasc, desc/YesSort nodes by the centrality score

Examples

The example is a web network, edge property @link.value can be used as weights:

File Writeback

SpecContent
filename_id,rank
UQL
algo(eigenvector_centrality).params({
  max_loop_num: 15,
  tolerance: 0.01,
  direction: "in"
}).write({
    file: {
      filename: 'rank'
    }
})

Results: File rank

File
web7,4.63007e-06
web6,0.0198426
web5,0.255212
web3,0.459901
web4,0.255214
web2,0.573512
web1,0.573511

Property Writeback

SpecContentWrite toData Type
propertyrankNode propertyfloat
UQL
algo(eigenvector_centrality).params({
  edge_weight_property: 'value'  
}).write({
    db: {
      property: 'ec'
    }
})

Results: Centrality score for each node is written to a new property named ec

Direct Return

Alias OrdinalType
Description
Columns
0[]perNodeNode and its centrality_uuid, rank
UQL
algo(eigenvector_centrality).params({
  max_loop_num: 20,
  tolerance: 0.01,
  edge_weight_property: '@link.value',
  direction: "in",
  order: 'desc'
}) as ec 
return ec

Results: ec

_uuidrank
10.73133802
60.48346400
20.43551901
30.17412201
40.098612003
50.041088000
70.0000000

Stream Return

Alias OrdinalType
Description
Columns
0[]perNodeNode and its centrality_uuid, rank

Example: Calculate weighted eigenvector centrality for all nodes, count the number of nodes with score above 0.4 or otherwise respectively

UQL
algo(eigenvector_centrality).params({
  edge_weight_property: '@link.value',
  direction: "in"
}).stream() as ec
with case
when ec.rank > 0.4 then 'attention'
when ec.rank <= 0.4 then 'normal'
END as r
group by r
return table(r, count(r))

Results: table(r, count(r))

rcount(r)
attention3
normal4