Skip to content

Instantly share code, notes, and snippets.

@MASaraji
Created May 6, 2021 21:21
Show Gist options
  • Save MASaraji/df63dfd4dc18dba133151cd5696bf3ab to your computer and use it in GitHub Desktop.
Save MASaraji/df63dfd4dc18dba133151cd5696bf3ab to your computer and use it in GitHub Desktop.
warshall algorithm
bin_matrix = [[0, 1, 0, 0], [1, 0, 1, 0], [0, 0, 0, 1], [0,0, 0, 0]]
length=range(len(bin_matrix))
for k in length:
for i in length:
for j in length:
if bin_matrix[i][k] and bin_matrix[k][j]:
bin_matrix[i][j] = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment