def __init__(self, n=0):  # a graph with Node 0,1,...,N-1
        self.n = n
        self.w = [
            [math.inf for j in range(0, n)] for i in range(0, n)
        ]  # adjacency matrix for weight
        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