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

Method __hash__

graphs/deep_clone_graph.py:28–33  ·  view source on GitHub ↗

>>> hash(Node(3)) != 0 True

(self)

Source from the content-addressed store, hash-verified

26 self.neighbors = self.neighbors or []
27
28 def __hash__(self) -> int:
29 """
30 >>> hash(Node(3)) != 0
31 True
32 """
33 return id(self)
34
35
36def clone_graph(node: Node | None) -> Node | None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected