
Tarjei, I do quite a bit of this sort of thing in my project. Here's what I do: Enumerate all the vertices in the source graph. For each source vertex: - create new vertex in target graph - save new target vertex descriptor in temporary map<vertex_descriptor_t/*source*/, vertex_descriptor_t/*target*/> - manually initialize target vertex properties Enumerate all the edges in the source graph. For each source edge: - create a new edge in the target (this is where the temporary map comes into play) - manually initialize target edge properties Nothing fancy but it works and is efficient. - Chris P.S. you could stuff this algorithm into an operator+ implementation if it's aesthetically pleasing to you ;-) "Tarjei Knapstad" <tarjeik@chemcon.no> wrote in message news:1062433891.31440.80.camel@cc-intern01...
On Mon, 2003-09-01 at 18:25, Tarjei Knapstad wrote:
I need to add/copy one graph into another, both completely connected, and then create an edge between one vertex in the original graph and a vertex in the one copied into it. The edge/vertex properties needs to be copied as well, and this needs to be fairly efficient.
The new edge is straightforward, but is there any functionality for the copy/add operation? (Something like an "add_component" algorithm I guess...) To my understanding both the copy_graph and copy_component algorithms both replace all the content in the target graph.
If not, what would be the most efficient way to solve this sort of problem?
Forgot to say that my graph type is
adjacency_list<vecS, vecS, undirectedS, VertexProperties, EdgeProperties>
where Vertex/EdgeProperties are a set of defined properties.
Regards, -- Tarjei Knapstad