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

Method __init__

dynamic_programming/floyd_warshall.py:5–8  ·  view source on GitHub ↗
(self, N = 0)

Source from the content-addressed store, hash-verified

3class Graph:
4
5 def __init__(self, N = 0): # a graph with Node 0,1,...,N-1
6 self.N = N
7 self.W = [[math.inf for j in range(0,N)] for i in range(0,N)] # adjacency matrix for weight
8 self.dp = [[math.inf for j in range(0,N)] for i in range(0,N)] # dp[i][j] stores minimum distance from i to j
9
10 def addEdge(self, u, v, w):
11 self.dp[u][v] = w

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected