Boost logo

Boost Users :

From: Dima F. (quantera_at_[hidden])
Date: 2007-04-19 16:50:01


Hello everybody,

Often, given a graph G and a subset of it's vertices, there is a need to perform
something on an induced graph containing those vertices. I thought about using
filtered_graph for that purpose, but for some reason I am unable to use
breadth_first_search with a filtered_graph - I get pages of errors from the
compiler complaining about something in filtered_graph.hpp, and I don't
understand what is the problem. Here is a minimal test program which
exemplifies the error. Note that if the line containing a call to a
breadth_first_search is commented out, everything compiles properly.
What is the problem here?

---------------------------------------------------------------------
#include <boost/graph/filtered_graph.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/breadth_first_search.hpp>

using namespace std;
using namespace boost;

template <typename Graph>
class induced_graph_filter {
public:

        typedef typename graph_traits<Graph>::edge_descriptor edge_t;
        typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;

        induced_graph_filter() {}

        bool operator()(const vertex_t &v) {}
                
        bool operator()(const edge_t &e) {}
};

int main() {
        typedef adjacency_list <listS, vecS, undirectedS> graph_t;

        graph_t g(2);
        add_edge(0, 1, g);

        typedef induced_graph_filter<graph_t> filter_t;
        filter_t filter;
        filtered_graph<graph_t, filter_t, filter_t> g2(g, filter);

        breadth_first_search(g2, 0, visitor(default_bfs_visitor()));
}
---------------------------------------------------------------------


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