|
Boost Users : |
From: Jeffrey Holle (jeff.holle_at_[hidden])
Date: 2005-02-08 18:40:11
Excuse me, I don't use graph properties, though I suspect they behave the same
as edge and vertex properties as far as subgraphs go.
What I can provide is the class that I used to wrap subgraphs.
The inner VertexData and EdgeData classes provide operator[] and iterator
interfaces. Look at the implementation of these methods to see the boost::get
usage.
This was developed for boost 1.31.1. I know that things have improved somewhat
in this area, but believe the subgraph/property things remain the same.
Gordon Smith wrote:
> I am not sure I follow - I am specifically talking about "graph_name_t" type
> properties (not vertex or edge properties) - can show a code snippet of how
> you get a reference to one for a specific subgraph?
>
> TIA,
>
> Gordon.
>
> "Jeffrey Holle" <jeff.holle_at_[hidden]> wrote in message
> news:cubfff$8mt$1_at_sea.gmane.org...
>
>>The answer is no.
>>The way I had to employ internal properties with subgraph is to use the
>
> root.
>
>>method of the subgraph class to access the properties of the root graph.
>>Note that the local to global vertex/edge index methods must also be used.
>>
>>The subgraph does have properties, just not the same as the roots.
>>
>>Gordon Smith wrote:
>>
>>>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