Boost logo

Boost Users :

From: Johan Oudinet (johan.oudinet_at_[hidden])
Date: 2006-04-07 11:35:00


On 4/7/06, Steven Van Ingelgem <steven.vaningelgem_at_[hidden]> wrote:

> What I have is 5000 cities (vertices), 14000 roads (edges) between them
> (directional roads)... And what I want to know is which roads I have to
> take to encounter the least cities on my way.
>
> Every edge has a weight of 1... So the documentation points me to using
> the breadth_first_search algorithm.
>
> But this function - as far as I can see - goes through the entire graph.
> I don't see any way to stop it (for example when it has discovered my
> targetcity)??
>
>
> Is it possible someone can point me where I can have a look at?

Yes, just throw an exception with a bfs visitor when it has discovered
your target city. Look at in archive of this mailing list, their are
some examples how to do that.

Regards,

--
Johan

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net