The Standard C++ and Boost Libraries
Examples for Boost Libraries

Examples for Boost Libraries

Table of Contents

Copy
MMP File for Copy
Source Code for Copy

 


Copy

This example demonstrates how to copy all of the vertices and edges from an adjacency list graph g1 to adjacency list graph g2 and adjacency list graph g3 to adjacency list graph g1.

An adjacency-list is a two-dimensional structure, where each element of the first dimension represents a vertex, and each of the vertices contain a one-dimensional structure that is its edge list. The copy_graph function copies all of the vertices and edges from graph g1 into g2 and g3 into g1. Also, it copies the vertex and edge properties by using either, the vertex_all and edge_all property maps, or by user-supplied copy functions. The binary function vertex_copy copies the properties of a vertex in the original graph into the corresponding vertex in the copy.

 


MMP File for Copy

The MMP file for Copy is as illustrated below:

TARGET		OpenCBoostCopy.exe
TARGETTYPE		exe
UID               		0x1000008d  0xe000000e


SYSTEMINCLUDE    	\epoc32\include 
SYSTEMINCLUDE    	\epoc32\include\stdapis
SYSTEMINCLUDE	\epoc32\include\stdapis\sys
SYSTEMINCLUDE    	\epoc32\include\stdapis\stlport
SYSTEMINCLUDE     	\epoc32\include\stdapis\boost

SOURCEPATH  	..\src
SOURCE		OpenCBoostCopy.cpp
SOURCEPATH      ..\data
START RESOURCE  OpenCBoostCopy_reg.rss
#ifdef WINSCW
TARGETPATH 	    \private\10003a3f\apps
#else
TARGETPATH 	    \private\10003a3f\import\apps
#endif
END //RESOURCE
USERINCLUDE	..\inc
STATICLIBRARY	libcrt0.lib
LIBRARY		libstdcpp.lib
LIBRARY		libc.lib
LIBRARY		libpthread.lib
LIBRARY		euser.lib
OPTION CW -wchar_t on
MACRO  _WCHAR_T_DECLARED

 


Source Code for Copy

Following code snippet is an example usage for the boost copy function:

#include<boost/graph/adjacency_list.hpp>
#include<boost/graph/copy.hpp>
#ifdef __GCCE__
#include<staticlibinit_gcce.h>
#endif
int failed_tests = 0;
using namespace boost;

class copier {
public:
    template <class V1, class V2>
		void operator()(const V1&, const V2&) const {}
};

int main()
{
    adjacency_list < vecS, vecS, directedS, property< vertex_root_t, int>>g1, g2;
		adjacency_list < vecS, vecS, directedS, property< vertex_index_t, int>>g3;
		printf("Call copy_graph with g1 and g2 adjacency_list");
    copy_graph(g1, g2);
    printf("Create Copier instance");
    copier c;
    printf("Call copy_graph with with vertex copy");
    copy_graph(g3, g1, vertex_copy(c));
    getchar();
    return 0;
}

Give feedback of this article


ŠNokia 2008

Back to top


This material, including documentation and any related computer programs, is protected by copyright controlled by Nokia. All rights are reserved. Copying, including reproducing, storing, adapting or translating, any or all of this material requires the prior written consent of Nokia. This material also contains confidential information, which may not be disclosed to others without the prior written consent of Nokia.

Nokia is a registered trademark of Nokia Corporation. S60 and logo is a trademark of Nokia Corporation. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. Other company and product names mentioned herein may be trademarks or tradenames of their respective owners.