Skip to content

Instantly share code, notes, and snippets.

@MASaraji
Last active May 7, 2021 08:51
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 MASaraji/51a5cab8529156e4721ac634d2efb104 to your computer and use it in GitHub Desktop.
Save MASaraji/51a5cab8529156e4721ac634d2efb104 to your computer and use it in GitHub Desktop.
warshal-floyd with permutations
bin_matrix = [[0, 1, 0, 0,0], [1, 0, 1, 0,0], [0, 0, 0, 1,1], [0,0, 0, 0,0],[0,0,0,0,0]]
from itertools import product
a=product(range(len(bin_matrix)),repeat=3)
a=filter(lambda a:bin_matrix[a[0]][a[1]] and bin_matrix[a[1]][a[2]],a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment