MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / Node

Class Node

graphs/page_rank.py:18–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17
18class Node:
19 def __init__(self, name):
20 self.name = name
21 self.inbound = []
22 self.outbound = []
23
24 def add_inbound(self, node):
25 self.inbound.append(node)
26
27 def add_outbound(self, node):
28 self.outbound.append(node)
29
30 def __repr__(self):
31 return f"<node={self.name} inbound={self.inbound} outbound={self.outbound}>"
32
33
34def page_rank(nodes, limit=3, d=0.85):

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected