# Discrepancy between IGEigenvectorCentrality and EigenvectorCentrality in Mathematica

I've been experimenting with directed graphs in Mathematica and I'm having some difficulty understanding the differences between IGEigenvectorCentrality and EigenvectorCentrality outputs.

Given the graph:

g = Graph[{1 -> 2, 2 -> 3, 3 -> 1, 1 -> 4, 2 -> 4, 4 -> 3}]


I get the following outputs for its eigenvector centrality:

IGEigenvectorCentrality[g]


Outputs:

{0.716673, 0.51362, 1., 0.881717}


While:

EigenvectorCentrality[g]


Outputs:

{0.230293, 0.165044, 0.321336, 0.283327}


I also computed the eigenvalues and eigenvectors for the adjacency matrix of the graph:

Eigensystem[AdjacencyMatrix[g]] // N


Which gave:

{{1.39534, -0.460355 + 1.13932 I, -0.460355 - 1.13932 I, -0.474627},
{{1.94697, 1.71667, 1.39534, 1.}, {-1.08612 - 1.04898 I, 0.695123 - 0.754529 I,
-0.460355 + 1.13932 I, 1.}, {-1.08612 + 1.04898 I, 0.695123 + 0.754529 I,
-0.460355 - 1.13932 I, 1.}, {0.22527, -1.10692, -0.474627, 1.}}}


I also tried:

e1 = EigenvectorCentrality[g]
Sum[e1[[i]], {i, 1, Length[e1]}]


which yields 1., then I did:

e2 = IGEigenvectorCentrality[g, Normalized -> False]


Output:

{0.448372, 0.321336, 0.62563, 0.551628}


But

Sum[e2[[i]]^2, {i, 1, Length[e2]}]


outputs 1.. So the eigenvectors must be normalized. However, I'm curious as to why there is a discrepancy between the results of IGEigenvectorCentrality and EigenvectorCentrality. Any insights?

There is no discrepancy. Eigenvector centrality is an eigenvector, thus it is defined only up to a constant factor.

In[14]:= IGEigenvectorCentrality[g] / EigenvectorCentrality[g]
Out[14]= {3.11201, 3.11201, 3.11201, 3.11201}

In[15]:= Equal @@ %
Out[15]= True


It does not make sense to look at eigenvector centralities as individual numbers. What is meaningful is the relation between the eigenvector centralities of two vertices of the same graph, e.g. one has a centrality twice larger than the other.

As a side note, you are computing eigenvector centrality for a directed graph. The concept was not developed for such graphs, and becomes problematic if the graph is not strongly connected (though your example is strongly connected). If you work with real-world directed networks, which tend not to be strongly connected, look into hub and authority scores.

You will find discrepancies if you use an undirected graph with self-loops due to slightly different definitions used by Mathematica and igraph. See here for all the details (igraph considers undirected self-loops twice, i.e. considers them to be traversable in both directions):

https://igraph.org/c/html/latest/igraph-Structural.html#igraph_eigenvector_centrality