[Lemon-user] SubDigraph and ListDigraph

Kovács Péter kpeter at inf.elte.hu
Tue Oct 25 21:40:57 CEST 2011


Hi,

 > Now I need to double my code

Do not duplicate your code! Write a template code with a template type 
parameter (the graph type).

Peter


On 2011.10.25. 15:57, Todorov, Vladimir wrote:
> Hi,
>
> It would have been nice if it actually  inherited the ListDigraph .... In such a case it would have been much easier to apply the same methods to the ListDigraph and the SubDigraph simply by casting the SubDigraph pointer into a ListDigraph one...  Thus, the interface would have remained the same. Now I need to double my code in order to be able to work with a ListDigraph and a particular subset of it....
>
> Regards,
>
> Vladimir
>
> -----Original Message-----
> From: Alpár Jüttner [mailto:alpar.juttner at gmail.com] On Behalf Of Alpár Jüttner
> Sent: Tuesday, October 25, 2011 3:40 PM
> To: Todorov, Vladimir
> Cc: lemon-user at lemon.cs.elte.hu
> Subject: Re: [Lemon-user] SubDigraph and ListDigraph
>
> Hi,
>>
>> I ran into a problem where I cannot convert a SubDigraph into a
>> ListDigraph. I use the SubDigraph to construct a subgraph of my
>> original ListDigraph. Now, how can I use the newly constructed
>> SubDigraph as a ListDigraph…?
>
> SubDigraph (and every other graph adaptor) doesn't create a physical graph structure in the memory, but instead it "simulates" the desired graph using the original graph and the auxiliary data. In spite of this, you can use it directly with any graph algorithm.
>
> If you still need to "convert" it to a ListDigraph, you must make a copy of it, most practically by using the digraphCopy() utility, e.g.:
>
>
> ListDigraph g;
> ListDigraph::NodeMap<bool>  n_filter(g);
> ListDigraph::ArcMap<bool>  a_filter(g);
> ...
> SubDigraph<ListDigraph>  sub_g(g,n_filter,a_filter); ...
> ListDigraph g2;
> digraphCopy(sub_g,g2);
>
> Regards,
> Alpar
>
>
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user




More information about the Lemon-user mailing list