connected component on a directed graph

Dear all, I see that it is already posted a lot of times, but i couldn't find an answer. Baiscally we want the connected component given a vertex given a directed graph. So a -> b -> c -> d e -> f would give {a, b, c, d} given b - for directed graphs there is only the strong component algorithm - for undirected graph there is an algorithm - there seems no adapter to fool the Bgl for interpreting a directed graph as undirected. Can anyone help? I am not a graph (or Bgl) expert, so maybe I am overlooking something. Wkr, me

On Sep 12, 2007, at 8:06 AM, gast128 wrote:
Dear all,
I see that it is already posted a lot of times, but i couldn't find an answer. Baiscally we want the connected component given a vertex given a directed graph.
So a -> b -> c -> d
e -> f
would give {a, b, c, d} given b
- for directed graphs there is only the strong component algorithm - for undirected graph there is an algorithm - there seems no adapter to fool the Bgl for interpreting a directed graph as undirected.
You can use the "incremental" connected components approach to compute connected components for a directed graph: http://www.boost.org/libs/graph/doc/incremental_components.html - Doug

Doug Gregor
You can use the "incremental" connected components approach to compute connected components for a directed graph:
http://www.boost.org/libs/graph/doc/incremental_components.html
- Doug
Thx. But the documentation states that it only works on undirected graphs: 'This section describes a family of functions and classes that work together to calculate the connected components of an undirected graph'

gast128 wrote:
Dear all,
I see that it is already posted a lot of times, but i couldn't find an answer. Baiscally we want the connected component given a vertex given a directed graph.
So a -> b -> c -> d
e -> f
would give {a, b, c, d} given b
- for directed graphs there is only the strong component algorithm - for undirected graph there is an algorithm - there seems no adapter to fool the Bgl for interpreting a directed graph as undirected.
Can anyone help? I am not a graph (or Bgl) expert, so maybe I am overlooking something.
I have written an adapter for bidirectional -> undirected, but I don't think it is really fit for production use. You might wanna search the boost-devel list archives. The code is at http://i11www.iti.uni-karlsruhe.de/~jmueller/undirected_graph_adapter.hpp Jens
participants (3)
-
Doug Gregor
-
gast128
-
Jens Müller