Last active
March 1, 2020 21:16
-
-
Save xyrolle/23b974ad4184754a82fcaeaf9c73b915 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import networkx as nx | |
def warshall(M): | |
n = M.shape[0] | |
W = M | |
for k in range(n): | |
for i in range(n): | |
for j in range(n): | |
W[i, j] = W[i, j] or (W[i, k] and W[k, j]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment