Opened 15 years ago
Closed 14 years ago
#1622 closed Bugs (fixed)
Adjacency list needs to handle self-edges correctly
Reported by: | Aaron Windsor | Owned by: | Andrew Sutton |
---|---|---|---|
Milestone: | Boost 1.36.0 | Component: | graph |
Version: | Boost 1.34.1 | Severity: | Problem |
Keywords: | Cc: |
Description
The following short program crashes as of boost 1.35:
#include <boost/graph/adjacency_list.hpp>
int main() {
using namespace boost; typedef adjacency_list<vecS, vecS, undirectedS > graph_t; graph_t g(5); add_edge(2, 2, g); remove_edge(2, 2, g);
}
The problem is that (2,2) is stored once in the list of edges in the graph and twice in the list of adjacent edges to the vertex 2. When remove_edge is called, the global graph edge (2,2) is deleted twice, causing a segfault. This problem is discussed in the following thread: http://lists.boost.org/Archives/boost/2007/02/116547.php.
Change History (3)
comment:1 by , 15 years ago
Status: | new → assigned |
---|
comment:2 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:3 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [50206]) Fixed #1622. A viable solution relies on the fact that incident edges in a loop are stored adjacently in the out edge list of the vertex. A simple modification of the global edge erasing loop for undirected graphs will skip the next iterator if both the current and next contain the same iterator.
Removing the loop using remove_edge(e, g) does not seem to trigger the same segfault.