Hello Everybody!
I am trying to extract a part of a graph. Speaking in terms of the BGL,
I do a copy from a filtered graph object into a new graph. To do so, I
defined a VerticePredicate for the filtered graph. As a result not all
vertices in the graph are present in the filtered version. This implies
that some edges do disappear in the filtered version fo the graph. In
order to copy from this filtered graph into a new, fresh graph via copy,
do I have to use the following EdgePredicate?
// edge predicate which only lets edges through which are part
// of the given VerticePredicate
template
struct edge_filter {
typedef boost::graph_traits<Graph> Traits;
typedef typename Traits::edge_descriptor Edge;
// needs to be default-constructible !
edge_filter() { }
edge_filter(Graph& g, VerticePredicate& vFilter)
: m_g(&g), m_vFilter(&vFilter) {}
bool operator()(const Edge& e) const {
return (*m_vFilter)(boost::target(e,*m_g)) &&
(*m_vFilter)(boost::source(e,*m_g));
}
private:
Graph* m_g;
VerticePredicate* m_vFilter;
};
Or is this not necessary and implicitly done by the filtered graph
interface?
Another thing concernig the copy-function: Is there a way to NOT copy
the vertice indices, but rather have the vertices renumbered from 1 to
size of filtered graph? I guess I have to cope with the
vertice_copier-function stuff, but I don't see how to do it.
And another matter: The copy_component function does not seem to be
documented. I found it by chance in the sources of copy.hpp.
Thanks a lot!
Sebastian Weber