Here is a complete snippet to copy a graph with bundled properties, but results in bunch of compiler errors. What is needed to fix the problems?
struct NodeInfo1 {};
struct EdgeInfo1 {};
typedef boost::labeled_graph< boost::adjacency_list<
boost::vecS, boost::vecS, boost::undirectedS, NodeInfo1, EdgeInfo1>,
std::string> Graph1;
typedef std::pair<boost::graph_traits<Graph>::edge_descriptor, bool> Edge;
void TestCases::TestCopyGraph()
{
Graph1 grid, g1;
EdgeInfo1 ei;
Edge e = add_edge_by_label("A", "B", ei, grid);
copy_graph(grid, g1);
}
That's slightly misrepresenting the question. You're not actually copying the adjacency list, you're copying the labeled_graph adaptor, which happens to not satisfy the concepts required by
copy_graph
:Here's copying the adjacency_list: ¹
Copying the Labeled adaptor
Is much easier. No
copy_graph
required, just copy-construct the object:Prints
¹ Note that you need this patch because of bugs in labeled_graph: https://github.com/boostorg/graph/pull/58