Boost logo

Boost Users :

Subject: Re: [Boost-users] BGL - accessing component subgraphs.
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-07-14 14:08:13


On Wed, 14 Jul 2010, Adam Spargo wrote:

> Any tips on the best way to access a subgraph - ideally without the memory
> overhead of copying the subgraph to a new object.
>
> I want to pass each component of my graph to an algorithm separately, but in
> some cases the original graph will only have a single or a few component(s),
> in other cases there will be many.
>
> Maybe I will do it differently depending on how many components I have.
>
> Any tips welcome.

There is a subgraph class in BGL, and also filtered_graph. Are the
subgraphs you're working with induced subgraphs (i.e., you do not
selectively remove edges other than by filtering out their endpoints)? The
subgraph class seems to make the subgraphs look more like normal graphs,
while filtered_graph is probably much simpler (it doesn't update
num_vertices() to match the subgraph size, for example). If you're
passing in something like the connected components of a graph
individually, that is an induced subgraph and so either of those classes
will work directly.

-- Jeremiah Willcock


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