Skip to content

Instantly share code, notes, and snippets.

@travisjungroth
Created May 23, 2019 23:14
Show Gist options
  • Save travisjungroth/0b7b52040397d49df69c3d129768d744 to your computer and use it in GitHub Desktop.
Save travisjungroth/0b7b52040397d49df69c3d129768d744 to your computer and use it in GitHub Desktop.
from graphs import depth_first_connected_nodes_iterative
graph = {
'A': {
'B',
},
'B': {
'C',
'D',
},
'C': {
'E',
},
'D': set(),
'E': set(),
'F': set(),
}
def test_depth_first_search():
assert depth_first_connected_nodes_iterative(graph, 'A') == set('ABCDE')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment