[BGL] Dijkstra Shortest Paths

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[BGL] Dijkstra Shortest Paths

Marcio Paim de Aquino
Hello all,

does anyone know how to make a custom dijkstra visitor that ends the
algorithm when
it finds the path between two especified vertexes?

Thanks,

Marcio


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [BGL] Dijkstra Shortest Paths

Michael Kettner
Hi Marcio!

On Wednesday 29 March 2006 14:43, Marcio Paim de Aquino wrote:
> Hello all,
>
> does anyone know how to make a custom dijkstra visitor that ends the
> algorithm when
> it finds the path between two especified vertexes?

You might read the manual. This is from
        http://www.boost.org/libs/graph/doc/faq.html


How do I perform an early exit from an algorithm such as BFS?

 Create a visitor that throws an exception when you want to cut off the
search, then put your call to breadth_first_search inside of an appropriate
try/catch block. This strikes many programmers as a misuse of exceptions,
however, much thought was put into the decision to have exceptions has the
preferred way to exit early. See boost email discussions for more details.


Regards,
 Michael

> Thanks,
>
> Marcio
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [BGL] Dijkstra Shortest Paths

Marcio Paim de Aquino
Michael Kettner escreveu:

>Hi Marcio!
>
>On Wednesday 29 March 2006 14:43, Marcio Paim de Aquino wrote:
>  
>
>>Hello all,
>>
>>does anyone know how to make a custom dijkstra visitor that ends the
>>algorithm when
>>it finds the path between two especified vertexes?
>>    
>>
>
>You might read the manual. This is from
> http://www.boost.org/libs/graph/doc/faq.html
>
>
>How do I perform an early exit from an algorithm such as BFS?
>
> Create a visitor that throws an exception when you want to cut off the
>search, then put your call to breadth_first_search inside of an appropriate
>try/catch block. This strikes many programmers as a misuse of exceptions,
>however, much thought was put into the decision to have exceptions has the
>preferred way to exit early. See boost email discussions for more details.
>
>
>Regards,
> Michael
>
>  
>
>>Thanks,
>>
>>Marcio
>>    
>>
>_______________________________________________
>Boost-users mailing list
>[hidden email]
>http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>  
>
I'm a newbie, so the manual is not much elucidative. I would like to see
some code and an
explanation if  possible. I would like to have a good understanding on
how to write a visitor
code, so maybe I could find a solution myself.
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users