[graph] removing self-edges bug?

Hi everyone! I think I've hit a but in the remove_edge(u,v,bg) function in case I want to delete a self-edge. The following code crashes on my machine: using namespace boost; typedef adjacency_list<vecS, vecS, undirectedS > ubase_graph_t; ubase_graph_t bg(5); add_edge(0, 1, bg); add_edge(1, 2, bg); add_edge(3, 4, bg); add_edge(4, 0, bg); add_edge(2, 2, bg); remove_edge(2, 2, bg); However, deleting via edge_descriptors is working: BGL_FORALL_OUTEDGES(2, ed, bg, ubase_graph_t) { if(target(ed, bg) == 2) { remove_edge(ed, bg); break; } } So what is wrong with remove_edge(u, u, bg) if there is a self-edge? My boost version is 1.34.1 and I am using g++ 4.1.2 on an ubuntu gutsy machine. Some info from gdb, but the output is just not usable to me - I have no clue what happens: *** glibc detected *** ../build/tools/gcc/debug/revTest: free(): invalid next size (fast): 0x08085420 *** ======= Backtrace: ========= /lib/tls/i686/cmov/libc.so.6[0xb743bd65] /lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb743f800] /usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb7603d81] ../build/tools/gcc/debug/revTest[0x804f943] ../build/tools/gcc/debug/revTest[0x804f978] ../build/tools/gcc/debug/revTest[0x8050c7f] ../build/tools/gcc/debug/revTest[0x8050cbf] ../build/tools/gcc/debug/revTest[0x80510f3] ../build/tools/gcc/debug/revTest[0x8051180] ../build/tools/gcc/debug/revTest[0x8049b4b] /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb73e8050] ../build/tools/gcc/debug/revTest(__gxx_personality_v0+0x81)[0x80497b1] Greetings, Sebastian

On Feb 6, 2008 4:39 AM, Sebastian Weber <sebastian.weber@physik.tu-darmstadt.de> wrote:
Hi everyone!
I think I've hit a but in the remove_edge(u,v,bg) function in case I want to delete a self-edge. The following code crashes on my machine:
using namespace boost; typedef adjacency_list<vecS, vecS, undirectedS > ubase_graph_t;
ubase_graph_t bg(5);
add_edge(0, 1, bg); add_edge(1, 2, bg); add_edge(3, 4, bg); add_edge(4, 0, bg); add_edge(2, 2, bg);
remove_edge(2, 2, bg);
However, deleting via edge_descriptors is working:
BGL_FORALL_OUTEDGES(2, ed, bg, ubase_graph_t) { if(target(ed, bg) == 2) { remove_edge(ed, bg); break; } }
So what is wrong with remove_edge(u, u, bg) if there is a self-edge?
Hi Sebastian, I can recreate the bug you're describing - this problem was actually brought up a year ago as well, see: http://lists.boost.org/Archives/boost/2007/02/116438.php. My reply to that message describes what's going on. I've put in a ticket in for this: http://svn.boost.org/trac/boost/ticket/1622. It won't be fixed for 1.35, but should be fixed by the next release. Unfortunately, the only workaround I can suggest is the one you've already discovered - removing by edge descriptor. Regards, Aaron

Hi Aaron, thanks for your hint and sorry for the spam - I did not think of checking the current bug list on the wiki. Next time. Greetings, Sebastian On Wed, 2008-02-06 at 08:53 -0500, Aaron Windsor wrote:
On Feb 6, 2008 4:39 AM, Sebastian Weber <sebastian.weber@physik.tu-darmstadt.de> wrote:
Hi everyone!
I think I've hit a but in the remove_edge(u,v,bg) function in case I want to delete a self-edge. The following code crashes on my machine:
using namespace boost; typedef adjacency_list<vecS, vecS, undirectedS > ubase_graph_t;
ubase_graph_t bg(5);
add_edge(0, 1, bg); add_edge(1, 2, bg); add_edge(3, 4, bg); add_edge(4, 0, bg); add_edge(2, 2, bg);
remove_edge(2, 2, bg);
However, deleting via edge_descriptors is working:
BGL_FORALL_OUTEDGES(2, ed, bg, ubase_graph_t) { if(target(ed, bg) == 2) { remove_edge(ed, bg); break; } }
So what is wrong with remove_edge(u, u, bg) if there is a self-edge?
Hi Sebastian,
I can recreate the bug you're describing - this problem was actually brought up a year ago as well, see: http://lists.boost.org/Archives/boost/2007/02/116438.php. My reply to that message describes what's going on. I've put in a ticket in for this: http://svn.boost.org/trac/boost/ticket/1622. It won't be fixed for 1.35, but should be fixed by the next release. Unfortunately, the only workaround I can suggest is the one you've already discovered - removing by edge descriptor.
Regards, Aaron _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

On Feb 6, 2008 9:41 AM, Sebastian Weber <sebastian.weber@physik.tu-darmstadt.de> wrote:
Hi Aaron,
thanks for your hint and sorry for the spam - I did not think of checking the current bug list on the wiki. Next time.
Greetings,
Sebastian
No worries - I added the bug because of your mail - not spam at all! Aaron
participants (2)
-
Aaron Windsor
-
Sebastian Weber