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
#include
#include
using namespace boost;
struct Node {
std::string name;
float weight;
};
typedef adjacency_list < setS, setS,
directedS,
property,
property
> 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::operator[](typename boost::property_traits<IndexMap>::key_type)
const [with GraphPtr =
boost::subgraph,
boost::property,
boost::no_property, boost::listS> >*, PropertyMap =
boost::adj_list_vertex_property_map, boost::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::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::property, boost:
:no_property, boost::listS> >*,
boost::adj_list_vertex_property_map, boost::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::property, boost::no_property, boost::listS>, int, int&,
boost::vertex_index_t>' requested