Boost logo

Boost Users :

Subject: Re: [Boost-users] [graph] abort algorithm execution from a visitor
From: Frank Tetzel (s1445051_at_[hidden])
Date: 2016-02-23 15:27:18


Hi,

thank you for the quick answer.

> for early exiting e.g. a BGL Dijkstra algorithm you can throw your
> local type as a signal and than catch this on the call site.
>
> Here are two early exit visitors I found useful:
> > https://gist.github.com/daniel-j-h/0301b07ff3324b44e0c5
>
> The first one is for the classical One-To-Many routing, the second one
> for One-To-Many routing scenario.
>
> The call site could look similar to:
>
> try {
> dijkstra_shortest_paths_no_color_map(graph,
> source,
> predecessor_map(predMap)
> .weight_map(weightMap)
> .disance_map(distanceMap)
> .visitor(stopOnTarget<Graph>{target}));
> } catch (const stopSearchSignal&) { }

So, throwing an exception is the way to go. I kinda dislike having
exceptions in my normal execution, but well. It's even in the FAQ which
i should have read before posting the question. Sorry for the noise.

> If you need more advanced features e.g. you want to do a bidirectional
> Dijkstra aborting in "the middle", follow this thread:
> > http://lists.boost.org/boost-users/2015/11/85302.php

Very interesting. Bidirectional search was next on my list, but i was
more interested in doing it in parallel instead of concurrently. Still
a nice solution. I have to do some reading up on coroutines.

Regards,
Frank


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