-
Notifications
You must be signed in to change notification settings - Fork 24
Metadata lost when a vertex is removed. #15
Comments
Actually, I think the problem is a bit different:
|
@my-little-repository this should now perform properly (that is,
). Let me know if you continue to see issues. |
Note that the code in my first post in this thread now returns an error.
It seems that it is an error to erase a non-existent vertex. In LightGraphs,
Finally note that |
You cannot iterate over vertices (or edges, or neighbors, or...) while modifying the graph in a loop. This is true for all graph types since we make no guarantees as to how the modification is performed. Any modification of the graph invalidates the loop variable. One solution is to use an iterator to gather a list of vertices you want to keep (or remove), and then use
This is, strictly speaking, not true:
|
In the following snippet, I create a graph with 5 nodes each labeled from "1" to "5". I then delete the node labeled "1" (which happens to be the first node) using the
rem_vertex!
function. As a result, the label "5" is lost. Is it the intended behavior?I understand why it is so (removing a vertex swaps it with the last vertex without copying the associated metadata) but that makes the metadata quite brittle.
The text was updated successfully, but these errors were encountered: