[Lemon-user] Using SmartArcSet and development code
Goldberg, Noam
ngoldber at telcordia.com
Tue May 12 23:40:28 CEST 2009
Alpar and all,
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).
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
________________________________________
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
More information about the Lemon-user
mailing list