[Lemon-user] strongly connected components

Alpár Jüttner alpar at cs.elte.hu
Sun Sep 19 07:09:56 CEST 2010


On Sat, 2010-09-18 at 11:36 -0700, Mark W Redekopp wrote:
> Hi all 
> 
> Can anyone just give me a brief example of how to call the strongly
> connected components function template on a simple ListDigraph?  I
> thought I could do something like this: 
> 
> Assume _g is a pointer to a ListDigraph 
> 
>   int num_components; 
>   lemon::ListDigraph::NodeMap<int> components( (*_g) ); 
>   components = stronglyConnectedComponents <lemon::ListDigraph,
> lemon::ListDigraph::NodeMap<int> >( (*_g), components);


This function returns a simple int, not a NodeMap. So try:

num_components = stronglyConnectedComponents <lemon::ListDigraph,
lemon::ListDigraph::NodeMap<int> >( (*_g), components);

The following is even better (you can omit the unambiguous template type
declaration.

num_components = stronglyConnectedComponents( (*_g), components);

Regards,
Alpar




More information about the Lemon-user mailing list