[Lemon-user] SubDigraph and ListDigraph

Todorov, Vladimir vladimir.todorov at intel.com
Wed Oct 26 14:48:08 CEST 2011


I didn't want to resort to making all graphs subgraphs. I tried copying the SubDigraph into a ListDigraph. All I can say is that it copies it, but it jumbles up the id's of the nodes and renders the copy unusable. It is too bad that the subgraph feature is highly unusable.

-----Original Message-----
From: Balázs Dezső [mailto:deba.mf at gmail.com] 
Sent: Wednesday, October 26, 2011 11:49 AM
To: Todorov, Vladimir
Cc: Kovács Péter; lemon-user at lemon.cs.elte.hu
Subject: Re: [Lemon-user] SubDigraph and ListDigraph

You can write code only for the subgraph, and you can pass filter maps with only true values if you want to use the code on the original graph.
I think, it has also a runtime drawback, but it is a solution for you.

Balazs

2011/10/26 Todorov, Vladimir <vladimir.todorov at intel.com>:
> Hi,
>
> Templates are really not always the solution. I would like to use a graph and a subgraph of it in an algorithm. The problem is that I might need to use them interchangeably i.e. if a particular subgraph exists use it, else use the whole graph etc... I need to dynamically switch between them within the same context.
>
> Regards,
>
> Vladimir
>
> -----Original Message-----
> From: Kovács Péter [mailto:kpeter at inf.elte.hu]
> Sent: Tuesday, October 25, 2011 9:41 PM
> To: Todorov, Vladimir
> Cc: Alpár Jüttner; lemon-user at lemon.cs.elte.hu
> Subject: Re: [Lemon-user] SubDigraph and ListDigraph
>
> 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
>
> _______________________________________________
> 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