Boost logo

Boost Users :

Subject: Re: [Boost-users] Graph: create_subgraph not defined
From: Trevor Harmon (Trevor.W.Harmon_at_[hidden])
Date: 2010-06-29 18:13:43


On Jun 28, 2010, at 12:23 PM, Trevor Harmon wrote:

> Design issues aside, I'm now trying to modify my graph code to use
> subgraphs. To start off, I thought I would try changing my
> adjacency_list to subgraph<adjacency_list>. Theoretically, my code
> should still work the same way, right? But I'm getting compiler errors
> when calling get().

I'm also getting compiler errors when calling add_vertex. Example:

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

using namespace boost;

class MyGraph :
        public subgraph<adjacency_list<vecS, vecS, bidirectionalS,
std::string, property<edge_index_t, std::size_t> > > {
};

int main(int,char*[]) {
        MyGraph g;
        std::string v;
        add_vertex(v, g);
        return 0;
}

error: no matching function for call to ‘add_vertex(std::string&,
MyGraph&)’
/Users/twharmon/Development/boost_1_43_0/boost/graph/subgraph.hpp:346:
note: candidates are: typename
boost::subgraph<Graph>::vertex_descriptor boost::add_vertex(typename
boost::subgraph<Graph>::vertex_descriptor, boost::subgraph<Graph>&)
[with G = boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS, std::string,
boost::property<boost::edge_index_t, size_t, boost::no_property>,
boost::no_property, boost::listS>]

The error goes away if I take out "subgraph" or simply change the
vertex type from std::string to a primitive type, such as size_t or
double.

So... have I completely misunderstood how to use subgraphs? Or am I
encountering some sort of Boost bug?

Thanks,

Trevor


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