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

Method __init__

Graphs/dijkstra_algorithm.py:81–86  ·  view source on GitHub ↗
(self, num)

Source from the content-addressed store, hash-verified

79
80class Graph:
81 def __init__(self, num):
82 self.adjList = {} # To store graph: u -> (v,w)
83 self.num_nodes = num # Number of nodes in graph
84 # To store the distance from source vertex
85 self.dist = [0] * self.num_nodes
86 self.par = [-1] * self.num_nodes # To store the path
87
88 def add_edge(self, u, v, w):
89 # Edge going from node u to v and v to u with weight w

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected