
I've stumbled upon a strange bug in the graph library. It seems that swapping an undirected adjacency_list back and forth to a copy of itself somehow causes some internal damage that becomes apparent when observing adjacenct vertices. I've attached a testcase that shows the problem. I'm using Boost 1.32 with gcc 3.4.2. Regards, Eelis #include <algorithm> #include <iterator> #include <iostream> #include <boost/graph/adjacency_list.hpp> int main () { typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> G; G g (3); add_edge(0, 1, g); add_edge(0, 2, g); G::adjacency_iterator i, j; boost::tie(i, j) = adjacent_vertices(0, g); std::copy(i, j, std::ostream_iterator<int>(std::cout, " ")); std::cout << std::endl; // Prints "1 2", as it should. { // This should not alter g: G t = g; g.swap(t); g.swap(t); } boost::tie(i, j) = adjacent_vertices(0, g); std::copy(i, j, std::ostream_iterator<int>(std::cout, " ")); std::cout << std::endl; // Prints "1 2 1 2", while it should still be "1 2". }