eigenvector centrality is equal to 0 for all nodes even in a strongly connected network

Hi everyone! Thanks for the great package. I’ve been having trouble understanding why I get full 0s as the eigenvector centrality of one of the directed networks I’m studying, even when I restrict it to the largest strongly connected component. I’ve created a link for its adjacency matrix (235x235) and have the full code that outputs my results below:

# Loads igraph
library(igraph)

# Imports the CSV File
url <- "https://www.dropbox.com/scl/fi/j3x6cz8nkdglsolvoe4wj/adj_matrix.csv?rlkey=v2grsi11vanj94a88akr4psj5&dl=1"
adj_matrix <- read.csv(url, header = TRUE)

# Converts network to an igraph Object
g <- graph_from_adjacency_matrix(as.matrix(adj_matrix), mode = "directed")

# Identifies Largest Weakly Connected Component
weak_components <- components(g, mode = "weak")
largest_weak_component <- induced_subgraph(g, which(weak_components$membership == which.max(weak_components$csize)))
cat("Size of Largest Weakly Connected Component:", length(V(largest_weak_component)), "\n")

# Calculates Eigenvector Centrality for largest Weakly Connected Component
weak_eigen_centrality <- eigen_centrality(largest_weak_component, directed = TRUE)$vector
print("Eigenvector Centrality (Weakly Connected):")
print(weak_eigen_centrality)

# Identifies Largest Strongly Connected Component
strong_components <- components(g, mode = "strong")
largest_strong_component <- induced_subgraph(g, which(strong_components$membership == which.max(strong_components$csize)))
cat("Size of Largest Strongly Connected Component:", length(V(largest_strong_component)), "\n")

# Calculates Eigenvector Centrality for largest Strongly Connected Component
strong_eigen_centrality <- eigen_centrality(largest_strong_component, directed = TRUE)$vector
print("Eigenvector Centrality (Strongly Connected):")
print(strong_eigen_centrality)

The result is all 0s for both the weakly connected and the strongly connected case. I believe this shouldn’t happen, right? My understanding is that there should be variation in the eigenvector centrality in this case. Could you help in checking what I’m doing wrong?

(Output for both cases, just for completeness:)

1 Like

I can reproduce the problem, and will look into it. This is unexpected. Thanks for the report!

What is happening here is that ARPACK fails to converge (without reporting an error) and returns an (incorrect) negative eigenvalue. igraph assumes that this can only happen due to numerical inaccuracies and the eigenvalue is only slightly below 0, thus everything must be zero.

Upgrading to a more recent version of ARPACK that doesn’t have this issue is in progress, but it will take some more time. I’ll also look into trying to detect bad results from ARPACK and issuing a warning (instead of returning zeros), if possible.

In the meantime, I suggest you use linear algebra tools to compute the leading eigenvector of this adjacency matrix.

1 Like

Tracked in `eigenvector_centrality()` mishandles wrong ARPACK result · Issue #2706 · igraph/igraph · GitHub

Thank you very much for your reply!