Skip to content

Instantly share code, notes, and snippets.

@RobertTalbert
Created February 19, 2016 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertTalbert/99e176d7ea40e77bfe05 to your computer and use it in GitHub Desktop.
Save RobertTalbert/99e176d7ea40e77bfe05 to your computer and use it in GitHub Desktop.
SageMath implementation of Warshall's algorithm
def warshall(M):
n = M.nrows()
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])
return W
@thasan3003
Copy link

thasan3003 commented Oct 16, 2019

Is the only iteration gives the final result or should I have to repeat this process?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment