
Analysis: vec_adj_list_impl's operator= calls this->clear() followed by copy_impl(x), where x is the vec_adj_list_impl that is being assigned from. copy_impl(x) _adds_ x's vertices and edges to this->m_vertices and this->m_edges. Therefore, it would seem that clear() should clear both of those. While clear() does immediately do m_vertices.clear(), it doesn't clear m_edges directly, but instead calls clear_dispatch(edge_property_type()). There are two overloads for clear_dispatch(): one function template parameterized by the property type, and a non-template overload that accepts a reference to const no_property. While the former immediately calls m_edges.clear(), the latter does nothing (empty function body). Consequently, in graphs whose edge_property_type is no_property, the edges from 'x' mentioned above are added to the currently existing edges, while they should replace them. Since I don't know the purpose of the clear_dispatch() overload for no_property, I have no idea what the solution should be. I've also attached a simpler testcase. Regards, Eelis #include <algorithm> #include <boost/graph/adjacency_list.hpp> int main () { typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> G; G g (2); add_edge(0, 1, g); G h = g; g = h; assert(num_edges(g) == num_edges(h)); // fails }