def floyd_warshall(self):
    d = {u: {v: inf for v in self.nodes} for u in self.nodes}
    for v in self.nodes:
        d[v][v] = 0
    for u in self.edges:
        for v in self.edges[u]:
            d[u][v] = self.edges[u][v]['weight']
    for w in self.nodes:
        for u in self.nodes:
            for v in self.nodes:
                d[u][v] = min(d[u][v], (d[u][w] + d[w][v]))
    return d
def floyd_warshall(self):
    d = {u: {v: inf for v in self.nodes} for u in self.nodes}
    for v in self.nodes:
        d[v][v] = 0
    for u in self.edges:
        for v in self.edges[u]:
            d[u][v] = self.edges[u][v]['weight']
    for w in self.nodes:
        for u in self.nodes:
            for v in self.nodes:
                d[u][v] = min(d[u][v], (d[u][w] + d[w][v]))
    return d