5
如何将类型adjacency_list的图形复制到另一个类型为adjacency_list的图形?将图形(adjacency_list)复制到另一个
typedef adjacency_list<setS, setS, undirectedS, NodeDataStruct, EdgeDataStruct> MyGraph;
MyGraph g1, g2;
// processing g1: adding vertices and edges ...
// processing g2: adding some vertices and edges ...
g1.clear();
g1 = g2 // this gives an execution error (exception)
g1 = MyGraph(g2); // this also gives an execution error
g2.clear();
对于copy_graph,据说图类型必须是VertexListGraph的模型。就我而言,我说过它是一个adjacency_list。 – shn 2012-02-13 14:56:28
@ user995434但是adjacency_list是VertexAndEdgeListGraph的一个模型,它是VertexListGraph的一种改进。因此,adjacency_list是VertexListGraph的模型。 – 2012-02-13 15:25:25
你可以给我一个使用copy_graph()的小例子来说明我想做什么吗?它总是给我编译错误。提前致谢。 – shn 2012-02-13 21:20:41