Boost logo

Boost Users :

Subject: [Boost-users] [graph] filtered graph and num_vertices
From: Miklós Tóth (spiralfuzet_at_[hidden])
Date: 2014-09-03 04:43:42


Hi All,

I have a graph, and I use a filter like this.

struct FilteredGraph : public boost::filtered_graph<SomeGraph, SomeFilter > {

    FilteredGraph(SomeGraph g) : boost::filtered_graph<SomeGraph,
SomeFilter>(g, SomeFilter(g)) {}

};

I want to use in this function.

template <class Graph>void some_graph_function(const Graph& g) {
const size_t vertex_num = boost::num_vertices(g);
    //...
}

Like this:

FilteredGraph fg(g)
some_graph_function(fg);

And I get:

> error: no matching function for call to 'num_vertices(const FilteredGraph&)'
> const size_t vertex_num = boost::num_vertices(g);
> ^

>From the boost 1.55 documentation:

> The num_vertices <http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/filtered_graph.html#num_vertices> and num_edges <http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/filtered_graph.html#num_edges> functions do not filter
> before returning results, so they return the number of vertices or
> edges in the underlying graph, unfiltered [2] <http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/filtered_graph.html#2>.
So it should work.

What am I missing?

Regards,
Miklós



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