Boost logo

Boost Users :

From: Christian Rössel (Christian.Roessel_at_[hidden])
Date: 2008-04-07 10:06:38


Hi,

thanks for the great graph library! My first attempts with boost.graph were
quite successful, but now I'm stuck. My question is: How can I get a
property_map from bundled properties in a subgraph? (boost 1.34.1, g++ and
VC8)

In the beginning I had a bidirectional graph with bundled properties and I
used a property map from the edge's bundled properties:

#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/subgraph.hpp>
using namespace boost;

struct VertexProperty
{
  // ...
};

struct EdgeProperty
{
  double length_;
  // ...
};

typedef adjacency_list<vecS, vecS, bidirectionalS,
                       VertexProperty,
                       EdgeProperty> Graph;

int main ()
{
  Graph g;
  typedef property_map<Graph, double EdgeProperty::*>::type EdgeWeightMap;
  EdgeWeightMap ewm = get (&EdgeProperty::length_, g);
  // use ewm in an algorithm ...
  return 0;
}

Everthing worked fine. Then, I had to change the graph-type from
adjacency_list to subgraph ...

typedef subgraph<
  adjacency_list<vecS, vecS, bidirectionalS,
                 property<vertex_index_t, int, VertexProperty>,
                 property<edge_index_t, int, EdgeProperty> > > Subgraph;

int main ()
{
  Subgraph g;
  typedef property_map<Subgraph, double EdgeProperty::*>::type EdgeWeightMap;
  EdgeWeightMap ewm = get (&EdgeProperty::length_, g);
  // use ewm in an algorithm ...
  return 0;
}

... and got this compile error:

In instantiation of `boost::property_map<Subgraph, double EdgeProperty::*>':
subgraph_property_map.cpp:45: instantiated from here
../../vendor/boost_1_34_1-multithread/boost/graph/properties.hpp:355: error: no type named `vertex_bundled' in `class Subgraph'
../../vendor/boost_1_34_1-multithread/boost/graph/properties.hpp:356: error: no type named `edge_bundled' in `class Subgraph'
../../vendor/boost_1_34_1-multithread/boost/graph/properties.hpp:360: error: no type named `vertex_bundled' in `class Subgraph'
../../vendor/boost_1_34_1-multithread/boost/graph/properties.hpp:360: error: `value' is not a member of `<declaration error>'
../../vendor/boost_1_34_1-multithread/boost/graph/properties.hpp:364: error: no type named `vertex_bundled' in `class Subgraph'
../../vendor/boost_1_34_1-multithread/boost/graph/properties.hpp:364: error: `value' is not a member of `<declaration error>'
../../vendor/boost_1_34_1-multithread/boost/graph/properties.hpp:367: error: no type named `vertex_bundled' in `class Subgraph'
../../vendor/boost_1_34_1-multithread/boost/graph/properties.hpp:367: error: `value' is not a member of `<declaration error>'
../../vendor/boost_1_34_1-multithread/boost/graph/properties.hpp:369: error: no type named `vertex_bundled' in `class Subgraph'
../../vendor/boost_1_34_1-multithread/boost/graph/properties.hpp:369: error:
`value' is not a member of `<declaration error>'

Is there a way to use property maps from bundled properties in a subgraph? If
not, can you give me a hint for a workaround, please.

Thanks and best regards,
Christian

__


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