Boost logo

Boost Users :

From: Gordon Smith (schmoo2k_at_[hidden])
Date: 2005-02-08 17:08:49


The following example produces the following (unexpected results):
name: graph
name: subgraph 1
name sg2: subgraph 2
name sg: subgraph 2

Do subgraphs share the same property_map?

Gordon.

// SubGraphPropertyTest.cpp : Defines the entry point for the console
application.
//
#include "stdafx.h"
#include <string>
#include <iostream>
#include <boost/cstdlib.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/subgraph.hpp>
int
main()
{
using namespace boost;
using std::string;
typedef adjacency_list<vecS, vecS, directedS,no_property,
property<edge_index_t, int>,
property<graph_name_t, string> > graph_t;
graph_t g;
get_property(g, graph_name) = "graph";
std::cout << "name: " << get_property(g, graph_name) << std::endl;
typedef subgraph<graph_t> subgraph_t;
subgraph_t sg;
get_property(sg, graph_name) = "subgraph 1";
std::cout << "name: " << get_property(sg, graph_name) << std::endl;
subgraph_t sg2 = sg.create_subgraph();
get_property(sg2, graph_name) = "subgraph 2";
std::cout << "name sg2: " << get_property(sg2, graph_name) << std::endl;
std::cout << "name sg: " << get_property(sg, graph_name) << std::endl;
return exit_success;
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net