MATLAB: Eigenvector centrality vs pagerank

eigenvector centralitygraph theorygraphsnodespagerank

According to this source (https://www.mathworks.com/help/matlab/ref/graph.centrality.html#inputarg_type) PageRank can be directed or undirected whereas eigenvalue centrality is strictly undirected. I'm having a hard time understanding why this is true (e.g. what is the core difference between eigenvalue centrality vs undirected PageRank) – I'm hoping once I understand this perhaps I'll have a better understanding of the fundamental differences between how these two methods work. Any help would be much appreciated!

Best Answer

It's possible to define eigenvector centrality for directed graphs, but it's rarely done, because in most cases the output is not easy to interpret or very useful. You can compute it easily for yourself, though:
[c, ~] = eigs(adjacency(G), [], 1, 'LM');
This is the eigenvector to the eigenvalue of G's adjacency matrix with largest magnitude (one could perhaps also use largest real part 'LR' instead).
One of the problems of eigenvector centrality is that if there are multiple components, typically only the largest component has any nonzero values. In MATLAB's 'eigenvector' centrality, we apply EIGS to every component separately. For directed graphs, the issue becomes much harder, because you have both strongly and weakly connected components.
Roughly speaking, eigenvector centrality is like using the power method:
for ii=1:maxit
c = A*c
c = c / sum(c);
end
In a directed graph with only one node that has no out-edges, this method will typically have all the centrality flowing to that one node, with all other nodes having centrality 0. This is not very useful!
In pagerank, there is an additional term adding to each node on every iteration, which gives a more useful equilibrium:
for ii=1:maxit
c = damp*A*c + (1 - damp);
end
Note this is a simplified version of pagerank just for illustration of the main point.