Skip to content

Instantly share code, notes, and snippets.

@xyrolle
Last active March 1, 2020 21:16
Show Gist options
  • Save xyrolle/23b974ad4184754a82fcaeaf9c73b915 to your computer and use it in GitHub Desktop.
Save xyrolle/23b974ad4184754a82fcaeaf9c73b915 to your computer and use it in GitHub Desktop.
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