Better error-message on pagerank ev-iter fail

This commit is contained in:
Dominik Moritz Roth 2022-01-31 14:02:00 +01:00
parent 3c0f1b18b4
commit 6e64e76310

View File

@ -483,7 +483,8 @@ def runPagerank(G):
try:
scores = nx.pagerank(G=G)
except nx.exception.PowerIterationFailedConvergence:
print('[!] Could not calculate pagerank-scores: power iteration of the eigenvector calculation did not converge')
print('[!] Could not calculate pagerank-scores: Power iteration of the eigenvector calculation did not converge')
print('[ ] Recommendations will be of slighly lower quality')
scores = {}
for n in list(G.nodes):
G.nodes[n]['pagerank_score'] = scores[n] if n in scores else 0