Yes, it is completely possible to use a filtered graph on top of filtered graph. It should probably have the same efficiency as combining the filters on top of the original graph.
Remember,
filtered_graph<G,EFG>
is a different type than the type offiltered_graph<F,EFF>
. Your compiler errors likely happen because you use the sameFilteredGraphType_t
in both locations of your code.
The correct code could look like:
Graph g;
typedef filtered_graph<G,EPred> FilteredGraphType_t;
FilteredGraphType_t fg(g, pred);
typedef filtered_graph<FilteredGraphType,SomePred> DeepFilteredGraphType_t;
DeepFilteredGraphType_t dfg(fg, somePred);
AFAIK, there is no documented way to access the "original" predicates used to form a filtered graph. Undocumented way is to use the internals of the Boost code as follows:
FilteredGraphType_t fg = ...
EPred edgeFilter = fg.m_edge_pred;
FilteredGraphType_t::edge_descriptor ed = ... bool edge_ok = edgeFilter(ed); //same as edgeFilter.operator()(ed);
It seems the recommended way would be to have your filter3
predicate as a member of your class A.