Note that there are some explanatory texts on larger screens.

plurals
  1. POBoost graph - after vertex removal, vertex still exists
    text
    copied!<p>Probably, it is a bug in the graph library of boost but perhaps you can help me out.</p> <p>As shown in a <a href="https://stackoverflow.com/questions/8506994/removing-vertex-and-adding-it-back-again-causes-crash-in-boostgraph">previous question</a> there is a problem with removing a vertex from a graph and adding it back again.</p> <p>My problem is slightly different. I have a <code>boost::labeled_graph</code> using an object pointer as label. Let <code>anObject</code> be a pointer to a particular object and let <code>aGraph</code> be a <code>boost::labeled_graph</code>. Then the following code is executed:</p> <pre><code>clear_vertex_by_label(anObject, aGraph); aGraph.remove_vertex(anObject); Vertex v = aGraph.vertex(anObject); </code></pre> <p>I would have expected an exception but instead <code>v</code> seems to be a vertex in <code>aGraph</code>. Now the following problem occurs (and I think it only occurs with <code>boost::labeled_graph</code>):</p> <p>When I execute the following code:</p> <pre><code>clear_vertex_by_label(anObject, aGraph); aGraph.remove_vertex(anObject); Vertex v = aGraph.add_vertex(aSecondObject); Vertex v2 = aGraph.vertex(anObject); Vertex v3 = aGraph.vertex(aSecondObject); </code></pre> <p>After execution of this code <code>v == v2 == v3</code> and that cannot be correct.</p> <p>Has got anyone an idea how to fix this problem? Is there a possibility to remove a label completely from the graph? I think that the label still exists and it still "points" to the same vertex node although the vertex itself is not the same anymore (or even if it does not exist).</p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload