[Lemon-user] Using SmartArcSet and development code

Kovács Péter kpeter at inf.elte.hu
Wed May 13 17:09:24 CEST 2009


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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: two_graph_reading.cc
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20090513/72eebe71/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: digraph.lgf
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20090513/72eebe71/attachment-0001.ksh>


More information about the Lemon-user mailing list