2008-03-11

Bidirectional search example



Dorian asked for implementation of bidirectional search algorithm. So I created very simple implementation of bidirectional search, not optimized at all. But I hope this is enough to understand the algorithm.

>>> from bidirectionalsearch import *
>>> bidirectional_search(graph,1,3)
[1, 2, 3]
>>> bidirectional_search(graph,1,8)
[1, 2, 3, 4, 7, 8]
>>> bidirectional_search(graph,1,9)
[]
>>> bidirectional_search(graph,1,11)
[]

2 comments:

Anonymous said...

link is broken

majek said...

Sorry, like always we had problems with server. Should work now.