Boost graph library breadth first search yielding incorrect predecessor map -


running breadth-first search on unweighted, directed graph on 2 vertices each vertex connected other yields predecessor map source of breadth-first search not own predecessor. following program sufficient produce behavior:

#include <vector> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/breadth_first_search.hpp>  using namespace boost; using std::vector;  enum family { one, two, n };  typedef adjacency_list< vecs, vecs, directeds> graph; typedef graph_traits<graph>::vertex_descriptor vertex;  int main() {     graph g(n);      const char *name[] = { "one", "two" };      add_edge(one, two, g);     add_edge(two, one, g);      vector<vertex> p(num_vertices(g));      breadth_first_search(g, two, visitor(make_bfs_visitor(                      record_predecessors(&p[0],                              on_tree_edge()))));      //at point, p[0] == 1 , p[1] == 0      return 0; } 

this seems contradict boost graph library documentation. more importantly, predecessor map should represent spanning tree of graph breadth-first search run on, not case when source of search not own predecessor.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -