BGL:add vertex and edge to subgraph
Hi,
I want to generate a local spanning tree of one graph(not MST) so I construct a subgraph of the original graph by add_vertex() and add_edge() function.
The problem is that after the add_vertex(). the local tree generate edges between the vertexes automaticlly. If I call add_edge() again, it will dumplicat edges since all the edges between existing vertex have been added by add_vertex() function.
I checked the example code of how to add vertex and edge in subgraph. It seems the add_vertex() function should not add edges automaticlly.
SUBGRAPH m_g;
...
//Create spanning tree
SUBGRAPH& localTree = m_g.create_subgraph();
//Add one vertex as root in spanning tree
boost::add_vertex(m_root, localTree);
//Add descendants to the tree
typedef graph_traits<SUBGRAPH> GTraits;
GTraits::out_edge_iterator tmpei, tmpei_end;
std::pair
participants (1)
-
Alice.gugu