I need to convert any bidirectional graph into an adjacency_list
, but looks
like the copy constructor cannot handle it (needs the same type in input).
I don't see any simple way to convert any directed graph into an adjacency_list
. Is there any more-or-less-simple way to do it that I don't know? May be there is a way to copy graphs constrained not by the concrete type of the graph, but only, may be, on graph concepts? Thanks, There's no direct conversion between *any* bidirectional graph and a directed adjancency_list. If you're talking about any bidirectional adjacency list and a directed one, you shouldn't actually need to convert them.
As an alternative, you could use copy_graph.
I need to do a copy of the graph before writing it into graphml or graphviz as a workaround for the problem I reported with subject [graph] Looks like there is a bug in some graph-writing function , which in my second message with the same subject I clarified the problem was related with creating dynamic_properties from bundled properties. It doesn't work with const graphs and I don't trust just performing a const_cast. I want to make sure that the input graph to my graph-writing functions is not modified at all. One solution would be just to do Graph *copy=new Graph(graph); where Graph is the graph-type template parameter, but this would require Graph to model Assignable, and I don't want to impose that. Also, copying the graph into a directed (not bidirectional) adjacency_list will save memory. copy_graph is perfect for my needs, as graph-writing boost functions already require the graph to model VertexListGraph (and, in general, the code I'm developing too). Sorry for not remembering about copy_graph and thank you very much :) Juan