find vertex using BFS

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

Hi,

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,

Pawel

Coordinator
Feb 14, 2010 at 10: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 8:13 AM

Thanks,

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