How can I copy a graph of type adjacency_list to another one graph of type 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();
Have you tried copy_graph?
Hard to know what the problem is without seeing the errors but if I had to guess, I’d first make sure you’re providing a
vertex_indexmap tocopy_graphsince it’s not available by default when you usesetSfor vertex storage. Based on your earlier question, it looks like you’ve already got that figured out so we just need to bring it all together.