Dijkstra
Dijkstra copied to clipboard
leafe nodes are missing in list
from dijkstra import Graph
def test_fixed_condition_list():
uut = Graph()
for key, value in [
('external', 'stopper'),
('goal', 'step2'),
('goal', 'stopper'),
('step1', 'start'),
('step1', 'step2'),
('step2', 'goal'),
('stopper', 'external'),
('stopper', 'goal'),
('stopper', 'step1'),
]:
uut.add_edge(key, value, 1)
assert list(uut.get_nodes()) == [
'stopper',
'step1',
'step2',
'goal',
'start',
'external'
]