Boost logo

Boost Users :

Subject: [Boost-users] [graph] abort algorithm execution from a visitor
From: Frank Tetzel (s1445051_at_[hidden])
Date: 2016-02-22 15:08:20

Hi all,

i played around with the bfs example calculating distances to all
vertices. Now i just want to calculate the distance between two
vertices, so i want to stop when the target vertex is visited.

If i understood the visitor concept correctly it's not really possible
to change the behaviour of the algorithm from a visitor. Does anybody
know of any workaround to do early exit? Do i have to implement a new
algorithm for this?

In a different thread on this list Paolo Bolzoni wrote that he aborts in
a custom visitor by throwing an exception. Is this the only way?

I'm using bfs here and not dijkstra because i have uniform edge weights.

Btw, if someone could fix the documentation that would be really nice:

The code snippet there did not work for me. I had to wrap
make_bfs_visitor() in visitor() like it is done in examples/bfs.cpp too.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at