Boost logo

Boost Users :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-09-24 17:22:16


If I understand you correctly, there's an adaptor called filtered_graph
that does this. You create a predicate functor that returns true for a
leaf (the functor will need to contain a handle to the property map) and
then the filtered_graph adaptor will give you all the various graph
iterators. You'll probably just want to use the vertex_iterator of the
filtered_graph.

On Tue, 24 Sep 2002, [iso-8859-1] Björn Lindberg wrote:
yg-boo> I have a BGL graph (adjacency_list). I use it to represent a tree,
yg-boo> and so I have an internal vertex property of type enum
yg-boo> representing the node type, ie ROOT, LEAF, INNER.
yg-boo>
yg-boo> Now, I would like a way to access only the leaves of a tree,
yg-boo> preferrably through iterators. I can't think of any good way to
yg-boo> accomplish this, except possibly by writing new iterator classes
yg-boo> which would internally keep track of a property map and thus hide
yg-boo> traversal of the non-leaf nodes from the code using the iterators.
yg-boo> This seems like a cumbersome approach though, and I'm hoping there
yg-boo> is a simpler way?
yg-boo>
yg-boo>
yg-boo> Björn

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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