Skip to content

Instantly share code, notes, and snippets.

@mynameisvinn
Created June 1, 2020 17:16
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 mynameisvinn/accfdd9188c0002d2b6f665f690e59b5 to your computer and use it in GitHub Desktop.
Save mynameisvinn/accfdd9188c0002d2b6f665f690e59b5 to your computer and use it in GitHub Desktop.
# we know the following graph is nilpontent
m = np.array([[0, 1, 0, 0, 0, 0],
[0, 0, 1, 1, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 1],
[0, 0, 0, 0, 0, 1],
[0, 0, 1, 0, 0, 0]])
for k in range(len(m)):
print(m)
print("-" * 15)
m = m.dot(m)
if np.sum(m) == 0:
print("finished at", k, "multiplies")
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment