Better error-message on pagerank ev-iter fail
This commit is contained in:
parent
3c0f1b18b4
commit
6e64e76310
@ -483,7 +483,8 @@ def runPagerank(G):
|
|||||||
try:
|
try:
|
||||||
scores = nx.pagerank(G=G)
|
scores = nx.pagerank(G=G)
|
||||||
except nx.exception.PowerIterationFailedConvergence:
|
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 = {}
|
scores = {}
|
||||||
for n in list(G.nodes):
|
for n in list(G.nodes):
|
||||||
G.nodes[n]['pagerank_score'] = scores[n] if n in scores else 0
|
G.nodes[n]['pagerank_score'] = scores[n] if n in scores else 0
|
||||||
|
Loading…
Reference in New Issue
Block a user