find vertex using BFS

Topics: algorithm, graph
Dec 13, 2009 at 11:26 AM
Edited Dec 13, 2009 at 12:54 PM


I would like to adopt BFS algorithm to find first vertex which fulfills specified by user condition. I can't find apropriate method in BreadthFirstSearchAlgorithm class. Is there any easy way to do it ? 

Thanks for help,


Feb 14, 2010 at 9:43 PM

Register to the ExamineVertex event of the BreadthFirstSearchAlgorithm - in that event, check the user condition. Then call Compute(v) where v is your root vertex.

Feb 24, 2010 at 7:13 AM


Yes, it's the solution, but it's possible to break search algorithm on the first occurence of vertex which satisfies user's codition ?