You filed an error, but you did not trace there.
Soon after, you received an answer:
You are not initializing the vertex_index property of your chart. Try adding code, for example:
graph_traits :: vertices_size_type i = 0;
BGL_FORALL_VERTICES (v, graph, Graph) put (vertex_index, g, v, i ++);
I tried this (typo correction) and it works fine:
#include <boost/graph/iteration_macros.hpp> int main() { Graph g; Vertex v = add_vertex(g); Vertex u = add_vertex(g); graph_traits<Graph>::vertices_size_type i = 0; BGL_FORALL_VERTICES(v, g, Graph) put(vertex_index, g, v, i++); bool inserted; tie(tuples::ignore, inserted) = add_edge(v, u, g); assert(inserted); VisitorClass vst; depth_first_search(g, visitor(vst)); // Should not print "back edge", but does. return 0; }
(at least it no longer prints "trailing edge")
Marshalllow
source share