Boost logo

Boost Users :

Subject: [Boost-users] [Graph] Subgraphs with bundled properties
From: Cooprider, Nathan \(US NonSSA\) (nathan.cooprider_at_[hidden])
Date: 2008-10-07 15:14:14


I am having some difficulty getting bundled properties working with
subgraphs in the BGL. Some sample code is below. If I comment out the
subgraph line and rename "PlainGraph" to be just "Graph" then the code
compiles. As it is written below, I get a type error (copied below the
code below). Any help/pointers would be appreciated. Thank you.

Nathan

#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/config.hpp>
#include <boost/graph/subgraph.hpp>

using namespace boost;

struct Node {
  std::string name;
  float weight;
};

typedef adjacency_list < setS, setS,
                         directedS,
                         property<vertex_index_t, int,
                                  Node >,
                         property<edge_index_t, int>
> PlainGraph;
typedef subgraph<PlainGraph> Graph;

int main () {
  Graph g;
  Graph::vertex_descriptor tmp = add_vertex(g);
  put(vertex_index, g, tmp, 42);
}

Here is the error:

/home/ncooprid/local/include/boost/graph/subgraph.hpp: In member
function 'typename boost::property_traits<IndexMap>::reference
boost::subgraph_local_property_map<GraphPtr, PropertyMap,
Tag>::operator[](typename boost::property_traits<IndexMap>::key_type)
const [with GraphPtr =
boost::subgraph<boost::adjacency_list<boost::setS, boost::setS,
boost::directedS, boost::property<boost::vertex_index_t, int, Node>,
boost::property<boost::edge_index_t, int, boost::no_property>,
boost::no_property, boost::listS> >*, PropertyMap =
boost::adj_list_vertex_property_map<boost::adjacency_list<boost::setS,
boost::setS, boost::directedS, boost::property<boost::vertex_index_t,
int, Node>, boost::property<boost::edge_index_t, int,
boost::no_property>, boost::no_property, boost::listS>, int, int&,
boost::vert
ex_index_t>, Tag = boost::vertex_index_t]':
/home/ncooprid/local/include/boost/graph/subgraph.hpp:843:
instantiated from 'void boost::put(Property, boost::subgraph<Graph>&,
const Key&, const Value&) [with G = boost::adjacency_list<boost::setS,
boost::setS, boost::directedS, boost::property<boost::vertex_index_t,
int, Node>, boost::property<boost::edge_index_t, int,
boost::no_property>, boost::no_property, boost::listS>, Property =
boost::vertex_index_t, Key = void*, Value = int]' error.cpp:24:
instantiated from here
/home/ncooprid/local/include/boost/graph/subgraph.hpp:738: error:
conversion from
'boost::subgraph_local_property_map<boost::subgraph<boost::adjacency_lis
t<boost::setS, boost::setS, boost::directedS,
boost::property<boost::vertex_index_t, int, Node>,
boost::property<boost::edge_index_t, int, boost::no_property>, boost:
:no_property, boost::listS> >*,
boost::adj_list_vertex_property_map<boost::adjacency_list<boost::setS,
boost::setS, boost::directedS, boost::property<boost::vertex_index_t,
int, Node>, boost::property<boost::edge_index_t, int,
boost::no_property>, boost::no_property, boost::listS>, int, int&,
boost::vertex_index_t>, boost::vertex_index_t>' to non-scalar type
'boost::adj_list_vertex_property_map<boost::adjacency_list<boost::setS,
boost::setS, boost::directedS, boost::property<boost::vertex_index_t,
int, Node>, boost::property<boost::edge_index_t, int,
boost::no_property>, boost::no_property, boost::listS>, int, int&,
boost::vertex_index_t>' requested


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