Search code examples
networkxdifferencepagerank

What are the differences among pagerank, pagerank_numpy and pagerank_scipy in NetworkX?


I checked the descriptions of pagerank, pagerank_numpy and pagerank_scipy from NetworkX documentation. I can't see the difference.

pagerank(G, alpha=0.85, personalization=None, max_iter=100, tol=1e-06, nstart=None, weight='weight', dangling=None)

pagerank_numpy(G, alpha=0.85, personalization=None, weight='weight', dangling=None)

pagerank_scipy(G, alpha=0.85, personalization=None, max_iter=100, tol=1e-06, weight='weight', dangling=None)

What are the differences among them?


Solution

  • They all compute the same thing but with slightly different methods to compute the largest eigenvalue/eigenvector (the pagerank scores).

    • pagerank is a pure-Python implementation
    • pagerank_numpy uses the dense linear algebra subpackage of numpy
    • pagerank_scipy uses the sparse linear algebra subpackage of scipy

    The pagerank_scipy implementation should be fastest and use the least memory for large graphs.