Skip to content

Instantly share code, notes, and snippets.

@scott2b
Last active April 6, 2018 16:03
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 scott2b/bc6a77dbe938c07f583f255d27b9f485 to your computer and use it in GitHub Desktop.
Save scott2b/bc6a77dbe938c07f583f255d27b9f485 to your computer and use it in GitHub Desktop.
# for each home destination, find all paths that lead back home and print only
# the ones that are a full traversal (i.e. 5 hops)
for home in graph.keys():
print("Home: %s" % home)
for start in graph.keys():
if (start != home):
print([path for path in find_path(graph, start, home) if len(path) == 5])
print("---")
print("=====")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment