[Lemon-user] Using SmartArcSet and development code
Goldberg, Noam
ngoldber at telcordia.com
Fri May 22 20:49:14 CEST 2009
Peter,
Thank you for the helpful examples a short while ago. The ArcSet classes do seem to work nicely/as expected in version 1.1.
I was also expecting to be able to use the skipNodes and useNodes methods of DigraphReader to be able to read the arcs of a graph (and possibly various ArcMaps and NodeMaps) without reading/redefining the nodes.
This for example may be useful in many cases where you have a graph G (or directed graph) which already implicitly defines the nodes of another graph G'. I.e. the nodes of G and G' could be the same or the nodes of G' can correspond to edges of G.
(BTW, it would also have been nice to have graph/digraph single get/set methods to get and set the entire set of nodes and/or ids and labels for the same purpose).
Noam
________________________________________
From: lemon-user-bounces at lemon.cs.elte.hu [lemon-user-bounces at lemon.cs.elte.hu] On Behalf Of Kovács Péter [kpeter at inf.elte.hu]
Sent: Wednesday, May 13, 2009 11:09 AM
To: lemon-user at lemon.cs.elte.hu
Subject: Re: [Lemon-user] Using SmartArcSet and development code
Dear Noam,
> I am sorry if I am flooding the mailing list with many questions but I hope to put Lemon into good use soon (and possibly get a few others to use it following this experience).
Not a problem. If you have questions, your letters are welcomed here.
> I reverted back to having several directed graphs using the same set of nodes instead of using ArcSet.
>
> I am reading the graphs from several lgf files, and I should be able to use useNodes for a graph and thus not have to read the nodes section once again (right?)
>
> DigraphReader<SmartDigraph> topoReader(topoGraph, TOPOFILE);// read the directed graph into topograph
> topoReader.nodeMap("label",labels);
> ...
> topoReader.run();
>
> and then:
>
> digraphReader(interferenceGraph, "interfgraph.lgf").useNodes(labels).skipNodes().run(); // to read the 2nd graph with the same set of nodes/ids
>
> Where the file INTERFILE contains only an arcs section.
>
> However, I get an error:
> Error: lemon:FormatError: Item not found: 0 (in file 'interfgraph.lgf' at line 3)
>
> When I read and empty set of arcs instead and print the resulting graph I get an empty graph, i.e. no nodes !
>
> Am I doing anything wrong here?
>
> Thanks in advance,
> Noam
I attached a simple example demonstrating the usage of ArcSet classes
combined with LGF reader along with an .lgf input file for it. I hope it
helps you.
You should update your lemon repository, since a bug fix is made today
for arc/edge sets. Or you can use the new stable version LEMON 1.1,
which is just released today.
Best regards,
Peter
> ________________________________________
> From: Alpár Jüttner [alpar at cs.elte.hu]
> Sent: Wednesday, May 06, 2009 6:41 AM
> To: Goldberg, Noam
> Cc: lemon-user at lemon.cs.elte.hu
> Subject: RE: [Lemon-user] Using SmartArcSet and development code
>
> On Tue, 2009-05-05 at 19:15 -0400, Goldberg, Noam wrote:
>> Thank you for your help.
>>
>> The following might be another silly question (perhaps it could become useful later for the documentation).
>>
>> Trying to read ArcSets from an LGF file by following the documentation of DigraphReader:
>> "An application of these functions is multipass reading, which is important if two @arcs sections must be read from the file. In this case the first phase would read the node set and one of the arc sets, while the second phase would read the second arc set into an ArcSet class (SmartArcSet or ListArcSet). The previously read label node map should be passed to the useNodes() functions. "
>>
>> How do you obtain the label node map ?
>
> The label node map is just a map (colunm in the .lgf file) with name
> (header) "label".
>
> You can obtain it like this:
>
> DigraphReader<ListGraph> reader(g,"file.lgf");
> ListGraph::NodeMap<int> labels(g);
> reader.nodeMap("label",labels);
>
>
>> The nodeMapNames of LgfContents provides a vector of strings but is not
>> a Lemon Map
>
> nodeMapNames() gives you the list of the node-map that can be found in
> the .lgf file (ontly their names not their contents). For example
> "label" should be amongst them.
>
> 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