📜  python warshall算法stackoverflow - Python代码示例

📅  最后修改于: 2022-03-11 14:46:37.783000             🧑  作者: Mango

代码示例1
def warshall(a):
    assert (len(row) == len(a) for row in a)
    n = len(a)
    for k in range(n):
        for i in range(n):
            for j in range(n):
                a[i][j] = a[i][j] or (a[i][k] and a[k][j])
    return a