Boost C++ Libraries: Ticket #7863: Bad graph after removing named vertex and then adding it again. https://svn.boost.org/trac10/ticket/7863 <p> Attached is a thin wrapper around boost::adjacency_list. Swapping lines 155 and 156 will switch between expected behavior and a corrupted graph Seems to be related to re-adding a vertex that was previously removed. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7863 Trac 1.4.3 anonymous Mon, 07 Jan 2013 05:26:59 GMT attachment set https://svn.boost.org/trac10/ticket/7863 https://svn.boost.org/trac10/ticket/7863 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">graphing.cpp</span> </li> </ul> Ticket Jeremiah Willcock Mon, 14 Jan 2013 19:27:19 GMT <link>https://svn.boost.org/trac10/ticket/7863#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7863#comment:1</guid> <description> <p> On lines 121 and 124, you are using <code>*tv</code> even after that vertex might have been deleted (on 121, it is known to have been deleted). Your comment about <code>*fv</code> being invalid after <code>*tv</code> has been removed is correct; in a graph with <code>vecS</code> vertex container, removing one vertex invalidates all other vertex descriptors. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 14 Jan 2013 19:59:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7863#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7863#comment:2</guid> <description> <p> A bug for sure on line 121, but on 124 the vertex would still be valid as it hasn't been removed. Either way those lines are there as I was trying to figure out what was wrong, and the bug reported stands whether none, either, or both lines 121, 124 are commented out. </p> <p> Final tree when connect called after disconnect: b-&gt;d </p> <p> Final tree when disconnect called after connect: c-&gt;b, a-&gt;b, c-&gt;d, b-&gt;d </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jeremiah Willcock</dc:creator> <pubDate>Mon, 14 Jan 2013 20:14:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7863#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7863#comment:3</guid> <description> <p> It looks like you cannot use a <code>vecS</code> vertex container with a <code>named_graph</code> when you remove vertices; there is nothing that updates the name lookup table based on the new vertex descriptors. Because unrelated vertex descriptors might be invalidated by <code>remove_vertex</code>, the table might need to be entirely rebuilt in that case. Could you please try <code>listS</code> or <code>setS</code> as vertex container (the second template parameter to <code>adjacency_list</code>) instead of <code>vecS</code>? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jeremiah Willcock</dc:creator> <pubDate>Mon, 14 Jan 2013 21:03:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7863#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7863#comment:4</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/82498" title="Added check to prevent use of remove_vertex on named adjacency list ...">[82498]</a>) Added check to prevent use of remove_vertex on named adjacency list graphs with vecS vertex container (since it does not work and could not be made to work efficiently); refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7863" title="#7863: Bugs: Bad graph after removing named vertex and then adding it again. (closed: wontfix)">#7863</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 14 Jan 2013 22:19:11 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7863#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7863#comment:5</guid> <description> <p> I've since updated to listS and things work as I want...but the vecS was definitely doing things it shouldn't so reported it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jeremiah Willcock</dc:creator> <pubDate>Mon, 14 Jan 2013 22:20:20 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7863#comment:6 https://svn.boost.org/trac10/ticket/7863#comment:6 <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">wontfix</span> </li> </ul> <p> You were right to report the issue; I added a check now so that other users will not get the same kind of subtle run-time error that you experienced. </p> Ticket