[graph] Is there a way to stop BFS when a certain vertex was visited?
Hi, I am using BFS to find the shortest path between two nodes as suggested in the documentation for unweighted graphs (or all weights == 1). I have written a visitor and can now access a shortest path from the start vertex to the vertex of interest. ==================================================================== My question is: HOW to stop further BFS traversal of the graph? ==================================================================== Is there a possibility e.g. by emptying the vertex queue (e.g. by the visitor)? Or some other, more elegant way to do? Thanks in advance for your help, Martin
On Thu, Aug 7, 2008 at 11:41 AM, Martin Mann
Hi,
I am using BFS to find the shortest path between two nodes as suggested in the documentation for unweighted graphs (or all weights == 1).
I have written a visitor and can now access a shortest path from the start vertex to the vertex of interest.
==================================================================== My question is: HOW to stop further BFS traversal of the graph? ====================================================================
Is there a possibility e.g. by emptying the vertex queue (e.g. by the visitor)? Or some other, more elegant way to do?
Throw an exception. See this thread for my performance comparisons. http://thread.gmane.org/gmane.comp.lib.boost.devel/171423/focus=171596 --Michael Fawcett
participants (2)
-
Martin Mann
-
Michael Fawcett