Boost C++ Libraries: Ticket #5779: Bug in Boost BGL graph traversal https://svn.boost.org/trac10/ticket/5779 <p> Using listS as the representation for both vertices and edges, BGL's depth_first_search sometimes calls back_edge() on visitors even if there are no cycles in the graph. </p> <p> Code example: <a class="ext-link" href="http://static.ali01.com/bgl.cc"><span class="icon">​</span>http://static.ali01.com/bgl.cc</a> </p> <p> The above program should not print "back edge", but does. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5779 Trac 1.4.3 public@… Fri, 12 Aug 2011 23:50:45 GMT attachment set https://svn.boost.org/trac10/ticket/5779 https://svn.boost.org/trac10/ticket/5779 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bgl.cc</span> </li> </ul> <p> code example of bug </p> Ticket Jeremiah Willcock Thu, 25 Aug 2011 19:52:35 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5779#comment:1 https://svn.boost.org/trac10/ticket/5779#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> You are not initializing the <code>vertex_index</code> property of your graph. Try adding some code such as: </p> <pre class="wiki">graph_traits&lt;Graph&gt;::vertices_size_type i = 0; BGL_FORALL_VERTICES(v, graph, Graph) put(vertex_index, g, v, i++); </pre><p> before your call to <code>depth_first_search</code> (filling in the types for your code, and <code>#include</code>ing <code>&lt;boost/graph/iteration_macros.hpp&gt;</code>). </p> Ticket