Boost logo

Boost Users :

Subject: [Boost-users] [Graph] how to find all shortest paths (not just one of them)?
From: Erik Sjölund (erik.sjolund_at_[hidden])
Date: 2010-11-03 05:19:36


Hi,
I managed to record a shortest path between two vertices by doing

adjacency_list < vecS, vecS, undirectedS > g;
std::vector<Vertex> p(boost::num_vertices(g));
Vertex vertex = *(boost::vertices(g).first);
boost::breadth_first_search(g, vertex,
  boost::visitor(
    boost::make_bfs_visitor(
      boost::record_predecessors(&p[0], boost::on_tree_edge())
    )
  )
);

The shortest path can be found by inspecting the vector p. But my goal
is slightly different.

Does anyone know how to "record" all shortest paths between two
vertices? (i.e. all paths having the minimal path length)

cheers,
Erik Sjölund


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