adidier17 / AuthorRank

A modification of PageRank to find the most prestigious authors in a scientific collaboration network.
MIT License
16 stars 7 forks source link

NetworkX >=3.0 breaks pagerank #32

Open willu47 opened 2 months ago

willu47 commented 2 months ago

From version 3 of NetworkX, PageRank was made a private function, so it is no longer accessible to the AuthorRank library causing the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /Users/wusher_1/repository/ccg/research_index/index.qmd:24
     19 ar_graph.fit(
     20     documents=corpus
     21 )
     23 # get the top authors for a set of documents
---> 24 ar_graph.top_authors(normalize_scores=True, n=10)

File /usr/local/Caskroom/miniforge/base/envs/quarto/lib/python3.12/site-packages/author_rank/graph.py:169, in Graph.top_authors(self, n, normalize_scores)
    166     return list(), list()
    168 else:
--> 169     top_authors, top_scores = top(self.graph, n=n, normalize_scores=normalize_scores)
    171     return top_authors, top_scores

File /usr/local/Caskroom/miniforge/base/envs/quarto/lib/python3.12/site-packages/author_rank/score.py:22, in top_authors(graph, n, normalize_scores)
      9 """
     10 Returns the top n authors according to their author_rank scores from the
     11 constructed graph as well as their scores, in the form of a tuple.
   (...)
     18 for their scores.
     19 """
     21 # apply the PageRank algorithm to the graph
---> 22 rank = nx.pagerank_scipy(graph)
     24 # sort the results
     25 sorted_rank = sorted(rank, key=rank.get, reverse=True)

AttributeError: module 'networkx' has no attribute 'pagerank_scipy'
vc1492a commented 2 months ago

Thanks for opening the issue @willu47.

The requirements.txt states that NetworkX version 2.6.3 must be used for AuthorRank. That said, the issue is noted for future development work.