Search code examples
rigraphgraph-theorydirected-grapheigenvector

Eigenvector in directed graph


I want to measure the eigenvector centrality of a directed graph of 262000 nodes and 1M edges in R using igraph package. When i run the command i get this error:

> ev<-evcent(amazon,directed=TRUE)

Error in .Call("R_igraph_eigenvector_centrality", graph, directed, scale, : At arpack.c:1174 : ARPACK error, Maximum number of iterations reached De plus : Warning message: In .Call("R_igraph_eigenvector_centrality", graph, directed, scale, : At arpack.c:776 :ARPACK solver failed to converge (1001 iterations, 0/1 eigenvectors converged)

I don't know what mean this error???


Solution

  • The error means what it says: Maximum number of iterations reached.

    You can increase the maximum number of iterations. Here is a reproducible example:

    First make a graph:

    > g <- make_ring(1000, directed=FALSE)
    

    Then set the default number of iterations to a small number:

    > arpack_defaults$maxiter = 10
    

    Pass that to eigen_centrality and get your error:

    > e = eigen_centrality(g, options=arpack_defaults)
    Error in .Call("R_igraph_eigenvector_centrality", graph, directed, scale,  : 
      At arpack.c:944 : ARPACK error, Maximum number of iterations reached
    In addition: Warning message:
    In .Call("R_igraph_eigenvector_centrality", graph, directed, scale,  :
      At arpack.c:776 :ARPACK solver failed to converge (11 iterations, 0/1 eigenvectors converged)
    

    So let's try with more iterations:

    > arpack_defaults$maxiter = 1000
    

    And see if that works:

    > e = eigen_centrality(g, options=arpack_defaults)
    

    No error!

    I do not know how large a number of iterations you will need for your graph, or how long it will take. Just keep adding zeroes until it either converges and returns correctly, or you give up because it is taking too long.