1 | <HTML> |
---|
2 | <!-- |
---|
3 | -- Copyright (c) Jeremy Siek 2000 |
---|
4 | -- |
---|
5 | -- Permission to use, copy, modify, distribute and sell this software |
---|
6 | -- and its documentation for any purpose is hereby granted without fee, |
---|
7 | -- provided that the above copyright notice appears in all copies and |
---|
8 | -- that both that copyright notice and this permission notice appear |
---|
9 | -- in supporting documentation. Jeremy Siek makes no |
---|
10 | -- representations about the suitability of this software for any |
---|
11 | -- purpose. It is provided "as is" without express or implied warranty. |
---|
12 | --> |
---|
13 | <Head> |
---|
14 | <Title>Boost Graph Library: Copy Graph</Title> |
---|
15 | <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" |
---|
16 | ALINK="#ff0000"> |
---|
17 | <IMG SRC="../../../boost.png" |
---|
18 | ALT="C++ Boost" width="277" height="86"> |
---|
19 | |
---|
20 | <BR Clear> |
---|
21 | |
---|
22 | <H1><TT>copy_graph</TT></H1> |
---|
23 | |
---|
24 | <PRE> |
---|
25 | template <class <a href="./VertexListGraph.html">VertexListGraph</a>, class <a href="./MutableGraph.html">MutableGraph</a>> |
---|
26 | void copy_graph(const VertexListGraph& G, MutableGraph& G_copy, |
---|
27 | const bgl_named_params<P, T, R>& params = <i>all defaults</i>) |
---|
28 | </PRE> |
---|
29 | |
---|
30 | This function copies all of the vertices and edges from graph |
---|
31 | <tt>G</tt> into <tt>G_copy</tt>. Also, it copies the vertex and edge |
---|
32 | properties, either by using the <tt>vertex_all</tt> and |
---|
33 | <tt>edge_all</tt> property maps, or by user-supplied copy functions. |
---|
34 | |
---|
35 | <H3>Where Defined</H3> |
---|
36 | |
---|
37 | <P> |
---|
38 | <a href="../../../boost/graph/copy.hpp"><TT>boost/graph/copy.hpp</TT></a> |
---|
39 | |
---|
40 | <P> |
---|
41 | |
---|
42 | <H3>Parameters</H3> |
---|
43 | |
---|
44 | IN: <tt>const VertexListGraph& G</tt> |
---|
45 | <blockquote> |
---|
46 | A directed or undirected graph. The graph type must be a model of <a href="./VertexListGraph.html">Vertex List Graph</a>. |
---|
47 | </blockquote> |
---|
48 | |
---|
49 | OUT: <tt>MutableGraph& G_copy</tt> |
---|
50 | <blockquote> |
---|
51 | The resulting copy of the graph. The graph type must be a model of <a |
---|
52 | href="./MutableGraph.html">Mutable Graph</a>. |
---|
53 | </blockquote> |
---|
54 | |
---|
55 | <h3>Named Parameters</h3> |
---|
56 | |
---|
57 | IN: <tt>vertex_copy(VertexCopier vc)</tt> |
---|
58 | <blockquote> |
---|
59 | 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 |
---|
60 | into the corresponding vertex in the copy.<br> |
---|
61 | |
---|
62 | <b>Default:</b> <tt>vertex_copier<VertexListGraph, MutableGraph></tt> |
---|
63 | which uses the property tag <tt>vertex_all</tt> to access a property |
---|
64 | map from the graph. |
---|
65 | </blockquote> |
---|
66 | |
---|
67 | IN: <tt>edge_copy(EdgeCopier ec)</tt> |
---|
68 | <blockquote> |
---|
69 | 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 |
---|
70 | into the corresponding edge in the copy.<br> |
---|
71 | |
---|
72 | <b>Default:</b> <tt>edge_copier<VertexListGraph, MutableGraph></tt> |
---|
73 | which uses the property tag <tt>edge_all</tt> to access a property |
---|
74 | map from the graph. |
---|
75 | </blockquote> |
---|
76 | |
---|
77 | IN: <tt>vertex_index_map(VertexIndexMap i_map)</tt> |
---|
78 | <blockquote> |
---|
79 | The vertex index map type must be a model of <a |
---|
80 | href="../../property_map/ReadablePropertyMap.html">Readable Property |
---|
81 | Map</a> and must map the vertex descriptors of <tt>G</tt> to the |
---|
82 | integers from 0 to <tt>num_vertices(G)</tt>.<br> |
---|
83 | |
---|
84 | <b>Default:</b> <tt>get(vertex_index, G)</tt> |
---|
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> |
---|