[BGL] undirectedS self-loop add_edge assertion
Just a quick mention: A call to add_edge with u == v causes an assertion if Directed == undirectedS. adjacency_list.hpp line 843: assert( u != v ); // don't allow self-loops ^- boost_1_28_0 Avoiding the assertion is easy enough but this is inconsistent w/section 14.1.1 p.220 of the BGL book: "... Also if u and v are descriptors for the same vertex (creating self loop) and the graph is undirected, then the edge will not be created and the flag will be false." Am having tons of fun - the BGL and the book are super. Thanks! - Chris
Thanks... I've been meaning to address this issue for a while. After thinking about this some more, I can't think of any really good real-world reasons for disallowing self-loops, other than that is typically done from a graph theory point of view. Also, other's have complained, saying they wanted to be able to insert self loops. I'll remove that assert. Cheers, Jeremy On Tue, 27 Aug 2002, Chris Russell wrote: cdr> Just a quick mention: cdr> cdr> A call to add_edge with u == v causes an assertion if Directed == cdr> undirectedS. cdr> cdr> adjacency_list.hpp line 843: cdr> assert( u != v ); // don't allow self-loops cdr> cdr> ^- boost_1_28_0 cdr> cdr> Avoiding the assertion is easy enough but this is inconsistent w/section cdr> 14.1.1 p.220 of the BGL book: "... Also if u and v are descriptors for the cdr> same vertex (creating self loop) and the graph is undirected, then the edge cdr> will not be created and the flag will be false." cdr> cdr> Am having tons of fun - the BGL and the book are super. Thanks! cdr> cdr> - Chris ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 855-3608 ----------------------------------------------------------------------
participants (2)
-
Chris Russell
-
Jeremy Siek