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

Method __init__

graphs/prim.py:16–28  ·  view source on GitHub ↗

Arguments: id - input an id to identify the vertex Attributes: neighbors - a list of the vertices it is linked to edges - a dict to store the edges's weight

(self, id_)

Source from the content-addressed store, hash-verified

14 """Class Vertex."""
15
16 def __init__(self, id_):
17 """
18 Arguments:
19 id - input an id to identify the vertex
20 Attributes:
21 neighbors - a list of the vertices it is linked to
22 edges - a dict to store the edges's weight
23 """
24 self.id = str(id_)
25 self.key = None
26 self.pi = None
27 self.neighbors = []
28 self.edges = {} # {vertex:distance}
29
30 def __lt__(self, other):
31 """Comparison rule to < operator."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected