| 1 | <HTML> | 
|---|
| 2 | <!-- | 
|---|
| 3 |   -- Copyright (c) Jeremy Siek 2000 | 
|---|
| 4 |   -- | 
|---|
| 5 |   -- Distributed under the Boost Software License, Version 1.0. | 
|---|
| 6 |   -- (See accompanying file LICENSE_1_0.txt or copy at | 
|---|
| 7 |   -- http://www.boost.org/LICENSE_1_0.txt) | 
|---|
| 8 |   --> | 
|---|
| 9 | <Head> | 
|---|
| 10 | <Title>Boost Graph Library: Copy Graph</Title> | 
|---|
| 11 | <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"  | 
|---|
| 12 |         ALINK="#ff0000">  | 
|---|
| 13 | <IMG SRC="../../../boost.png"  | 
|---|
| 14 |      ALT="C++ Boost" width="277" height="86">  | 
|---|
| 15 |  | 
|---|
| 16 | <BR Clear> | 
|---|
| 17 |  | 
|---|
| 18 | <H1><TT>copy_graph</TT></H1> | 
|---|
| 19 |  | 
|---|
| 20 | <PRE> | 
|---|
| 21 | template <class <a href="./VertexListGraph.html">VertexListGraph</a>, class <a href="./MutableGraph.html">MutableGraph</a>>  | 
|---|
| 22 | void copy_graph(const VertexListGraph& G, MutableGraph& G_copy, | 
|---|
| 23 |     const bgl_named_params<P, T, R>& params = <i>all defaults</i>) | 
|---|
| 24 | </PRE> | 
|---|
| 25 |  | 
|---|
| 26 | This function copies all of the vertices and edges from graph | 
|---|
| 27 | <tt>G</tt> into <tt>G_copy</tt>. Also, it copies the vertex and edge | 
|---|
| 28 | properties, either by using the <tt>vertex_all</tt> and | 
|---|
| 29 | <tt>edge_all</tt> property maps, or by user-supplied copy functions. | 
|---|
| 30 |  | 
|---|
| 31 | <H3>Where Defined</H3> | 
|---|
| 32 |  | 
|---|
| 33 | <P> | 
|---|
| 34 | <a href="../../../boost/graph/copy.hpp"><TT>boost/graph/copy.hpp</TT></a> | 
|---|
| 35 |  | 
|---|
| 36 | <P> | 
|---|
| 37 |  | 
|---|
| 38 | <H3>Parameters</H3> | 
|---|
| 39 |  | 
|---|
| 40 | IN: <tt>const VertexListGraph& G</tt> | 
|---|
| 41 | <blockquote> | 
|---|
| 42 | A directed or undirected graph. The graph type must be a model of <a href="./VertexListGraph.html">Vertex List Graph</a>. | 
|---|
| 43 | </blockquote> | 
|---|
| 44 |  | 
|---|
| 45 | OUT: <tt>MutableGraph& G_copy</tt> | 
|---|
| 46 | <blockquote> | 
|---|
| 47 | The resulting copy of the graph.  The graph type must be a model of <a | 
|---|
| 48 | href="./MutableGraph.html">Mutable Graph</a>. | 
|---|
| 49 | </blockquote> | 
|---|
| 50 |  | 
|---|
| 51 | <h3>Named Parameters</h3> | 
|---|
| 52 |  | 
|---|
| 53 | IN: <tt>vertex_copy(VertexCopier vc)</tt> | 
|---|
| 54 | <blockquote> | 
|---|
| 55 | This is a <a href="http://www.sgi.com/tech/stl/BinaryFunction.html">Binary Function</a> that copies the properties of a vertex in the original graph | 
|---|
| 56 | into the corresponding vertex in the copy.<br> | 
|---|
| 57 |  | 
|---|
| 58 | <b>Default:</b> <tt>vertex_copier<VertexListGraph, MutableGraph></tt> | 
|---|
| 59 | which uses the property tag <tt>vertex_all</tt> to access a property | 
|---|
| 60 | map from the graph. | 
|---|
| 61 | </blockquote> | 
|---|
| 62 |  | 
|---|
| 63 | IN: <tt>edge_copy(EdgeCopier ec)</tt> | 
|---|
| 64 | <blockquote> | 
|---|
| 65 | This is a <a href="http://www.sgi.com/tech/stl/BinaryFunction.html">Binary Function</a> that copies the properties of an edge in the original graph | 
|---|
| 66 | into the corresponding edge in the copy.<br> | 
|---|
| 67 |  | 
|---|
| 68 | <b>Default:</b> <tt>edge_copier<VertexListGraph, MutableGraph></tt> | 
|---|
| 69 | which uses the property tag <tt>edge_all</tt> to access a property | 
|---|
| 70 | map from the graph. | 
|---|
| 71 | </blockquote> | 
|---|
| 72 |  | 
|---|
| 73 | IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt> | 
|---|
| 74 | <blockquote> | 
|---|
| 75 | The vertex index map type must be a model of <a | 
|---|
| 76 | href="../../property_map/ReadablePropertyMap.html">Readable Property | 
|---|
| 77 | Map</a> and must map the vertex descriptors of <tt>G</tt> to the | 
|---|
| 78 | integers in the half-open range <tt>[0,num_vertices(G))</tt>.<br> | 
|---|
| 79 |  | 
|---|
| 80 | <b>Default:</b> <tt>get(vertex_index, G)</tt>. | 
|---|
| 81 | Note: if you use this default, make sure your graph has | 
|---|
| 82 | an internal <tt>vertex_index</tt> property. For example, | 
|---|
| 83 | <tt>adjacenty_list</tt> with <tt>VertexList=listS</tt> does | 
|---|
| 84 | not have an internal <tt>vertex_index</tt> property. | 
|---|
| 85 | </blockquote> | 
|---|
| 86 |  | 
|---|
| 87 |  | 
|---|
| 88 | UTIL/OUT: <tt>orig_to_copy(Orig2CopyMap c)</tt> | 
|---|
| 89 | <blockquote> | 
|---|
| 90 | This maps vertices in the original graph to vertices in the copy. | 
|---|
| 91 |  | 
|---|
| 92 | <b>Default:</b> an <a | 
|---|
| 93 |   href="../../property_map/iterator_property_map.html"> | 
|---|
| 94 |   </tt>iterator_property_map</tt></a> created from a | 
|---|
| 95 |   <tt>std::vector</tt> of the output graph's vertex descriptor type of size | 
|---|
| 96 |   <tt>num_vertices(g)</tt> and using the <tt>i_map</tt> for the index | 
|---|
| 97 |   map. | 
|---|
| 98 | </blockquote> | 
|---|
| 99 |  | 
|---|
| 100 | <H3>Complexity</H3> | 
|---|
| 101 |  | 
|---|
| 102 | <P> | 
|---|
| 103 | The time complexity is <i>O(V + E)</i>. | 
|---|
| 104 |  | 
|---|
| 105 |  | 
|---|
| 106 |  | 
|---|
| 107 | <br> | 
|---|
| 108 | <HR> | 
|---|
| 109 | <TABLE> | 
|---|
| 110 | <TR valign=top> | 
|---|
| 111 | <TD nowrap>Copyright © 2000-2001</TD><TD> | 
|---|
| 112 | <A HREF="../../../people/jeremy_siek.htm">Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>) | 
|---|
| 113 | </TD></TR></TABLE> | 
|---|
| 114 |  | 
|---|
| 115 | </BODY> | 
|---|
| 116 | </HTML>  | 
|---|