fix: Handle ZeroDivisionError in PageRank calculation

This commit is contained in:
Paul Gauthier 2024-09-23 11:49:16 -07:00
parent ed1eb38c5f
commit a4b79127b0

View file

@ -398,7 +398,11 @@ class RepoMap:
try:
ranked = nx.pagerank(G, weight="weight", **pers_args)
except ZeroDivisionError:
return []
# Issue #1536
try:
ranked = nx.pagerank(G, weight="weight")
except ZeroDivisionError:
return []
# distribute the rank from each source node, across all of its out edges
ranked_definitions = defaultdict(float)