Skip to content

Commit c59b8b1

Browse files
author
deepshekhardas
committed
fix: initialize PageRank to 1/n instead of 1
1 parent c0db072 commit c59b8b1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

graphs/page_rank.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __repr__(self):
3434
def page_rank(nodes, limit=3, d=0.85):
3535
ranks = {}
3636
for node in nodes:
37-
ranks[node.name] = 1
37+
ranks[node.name] = 1 / len(nodes)
3838

3939
outbounds = {}
4040
for node in nodes:

0 commit comments

Comments
 (0)