Lemon Graph Format uses label instead of id named map.
authordeba
Tue, 24 Jan 2006 16:07:38 +0000
changeset 1901723b2b81d900
parent 1900 b16ca599472f
child 1902 e9af75c90c28
Lemon Graph Format uses label instead of id named map.
demo/coloring.lgf
demo/dir_components.lgf
demo/graph_orientation.cc
demo/graph_orientation.lgf
demo/partitions.lgf
demo/route.lgf
demo/sample.lgf
demo/sub_gad_input.lgf
demo/undir_components.lgf
doc/graph_io.dox
gui/graphocska.lgf
lemon/graph_reader.h
lemon/graph_writer.h
lemon/lemon_reader.h
lemon/lemon_writer.h
test/Makefile.am
test/dijkstra_test.lgf
     1.1 --- a/demo/coloring.lgf	Thu Jan 19 16:56:39 2006 +0000
     1.2 +++ b/demo/coloring.lgf	Tue Jan 24 16:07:38 2006 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4  @nodeset 
     1.5 -coords	id	
     1.6 +coords	label	
     1.7  (162, 142)	10	
     1.8  (169, -35)	9	
     1.9  (-154, -37)	8	
    1.10 @@ -12,7 +12,7 @@
    1.11  (157, -150)	1	
    1.12  (-282, -149)	0	
    1.13  @undiredgeset 
    1.14 -		id	
    1.15 +		label	
    1.16  9	10	17	
    1.17  1	9	15	
    1.18  3	9	14	
     2.1 --- a/demo/dir_components.lgf	Thu Jan 19 16:56:39 2006 +0000
     2.2 +++ b/demo/dir_components.lgf	Tue Jan 24 16:07:38 2006 +0000
     2.3 @@ -1,5 +1,5 @@
     2.4  @nodeset 
     2.5 -coordinates_x	coordinates_y	id	
     2.6 +coordinates_x	coordinates_y	label	
     2.7  218.178	27.2723	19	
     2.8  157.79	-130.517	18	
     2.9  44.8044	15.5841	17	
    2.10 @@ -20,7 +20,7 @@
    2.11  -227.918	-40.9084	2	
    2.12  -389.604	-136.361	1	
    2.13  @edgeset 
    2.14 -		id	
    2.15 +		label	
    2.16  17	19	23	
    2.17  19	18	24	
    2.18  18	17	25	
     3.1 --- a/demo/graph_orientation.cc	Thu Jan 19 16:56:39 2006 +0000
     3.2 +++ b/demo/graph_orientation.cc	Tue Jan 24 16:07:38 2006 +0000
     3.3 @@ -49,13 +49,13 @@
     3.4    ListGraph g;
     3.5  
     3.6    ListGraph::NodeMap<int> f(g); //in-deg requirement;
     3.7 -  ListGraph::NodeMap<int> id(g);
     3.8 +  ListGraph::NodeMap<int> label(g);
     3.9    ListGraph::NodeMap<xy<double> > coords(g);
    3.10    
    3.11    try {
    3.12      GraphReader<ListGraph> reader(argv[1],g);
    3.13      reader.readNodeMap("f",f);
    3.14 -    reader.readNodeMap("id",id);
    3.15 +    reader.readNodeMap("label",label);
    3.16      reader.readNodeMap("coordinates_x",xMap(coords));
    3.17      reader.readNodeMap("coordinates_y",yMap(coords));
    3.18      reader.run();
    3.19 @@ -80,15 +80,15 @@
    3.20    
    3.21    Node act;
    3.22    while((act=IterableBoolNodeMap<ListGraph>::TrueIt(active))!=INVALID) {
    3.23 -    std::cout << "Process node " << id[act]
    3.24 +    std::cout << "Process node " << label[act]
    3.25  	      << " (def=" << def[act]
    3.26  	      << " lev=" << level[act] << "): ";
    3.27      OutEdgeIt e(g,act);
    3.28      while(e!=INVALID && level[g.target(e)]>=level[act]) ++e;
    3.29      if(e!=INVALID) {
    3.30        std::cout << " REVERT EDGE " << g.id(e)
    3.31 -		<< " (" << id[g.source(e)] << "---"
    3.32 -		<< id[g.target(e)] << ")"
    3.33 +		<< " (" << label[g.source(e)] << "---"
    3.34 +		<< label[g.target(e)] << ")"
    3.35  		<< std::endl;
    3.36        if(--def[act]==0) active[act]=false;
    3.37        if(++def[g.target(e)]>0) active[g.target(e)]=true;
     4.1 --- a/demo/graph_orientation.lgf	Thu Jan 19 16:56:39 2006 +0000
     4.2 +++ b/demo/graph_orientation.lgf	Tue Jan 24 16:07:38 2006 +0000
     4.3 @@ -1,5 +1,5 @@
     4.4  @nodeset 
     4.5 -coordinates_x	coordinates_y	f	id	
     4.6 +coordinates_x	coordinates_y	f	label	
     4.7  -198	-73	2	7	
     4.8  120	30	4	6	
     4.9  -17	222	1	5	
    4.10 @@ -8,7 +8,7 @@
    4.11  -28	-93	1	2	
    4.12  -131	83	3	1	
    4.13  @edgeset 
    4.14 -		id	
    4.15 +		label	
    4.16  7	6	3	
    4.17  1	6	2	
    4.18  2	6	1	
     5.1 --- a/demo/partitions.lgf	Thu Jan 19 16:56:39 2006 +0000
     5.2 +++ b/demo/partitions.lgf	Tue Jan 24 16:07:38 2006 +0000
     5.3 @@ -1,5 +1,5 @@
     5.4  @nodeset 
     5.5 -coordinates_x	coordinates_y	id	
     5.6 +coordinates_x	coordinates_y	label	
     5.7  513.857		-446.322	23	
     5.8  393.468		566.711		22	
     5.9  869.153		52.8539		21	
    5.10 @@ -24,7 +24,7 @@
    5.11  -607.82		-246.651	2	
    5.12  -274		-131		1	
    5.13  @undiredgeset 
    5.14 -		id	
    5.15 +		label	
    5.16  12	23	15	
    5.17  13	23	14	
    5.18  4	22	23	
     6.1 --- a/demo/route.lgf	Thu Jan 19 16:56:39 2006 +0000
     6.2 +++ b/demo/route.lgf	Tue Jan 24 16:07:38 2006 +0000
     6.3 @@ -1,5 +1,5 @@
     6.4  @nodeset
     6.5 -id	coordinates_x	coordinates_y	
     6.6 +label	coordinates_x	coordinates_y	
     6.7  9	447.907	578.328	
     6.8  8	79.2573	909.464	
     6.9  7	878.677	960.04	
    6.10 @@ -11,7 +11,7 @@
    6.11  1	408.248	577.327	
    6.12  0	189.239	92.5316	
    6.13  @edgeset
    6.14 -		length	id	
    6.15 +		length	label	
    6.16  2	3	901.074	0	
    6.17  8	5	270.85	1	
    6.18  6	9	601.553	2	
     7.1 --- a/demo/sample.lgf	Thu Jan 19 16:56:39 2006 +0000
     7.2 +++ b/demo/sample.lgf	Tue Jan 24 16:07:38 2006 +0000
     7.3 @@ -1,5 +1,5 @@
     7.4  @nodeset
     7.5 -id      coordinates_x   coordinates_y
     7.6 +label      coordinates_x   coordinates_y
     7.7  5       796.398 208.035
     7.8  4       573.002 63.002
     7.9  3       568.549 401.748
    7.10 @@ -7,7 +7,7 @@
    7.11  1       288.248 397.327
    7.12  0       102.239 257.532
    7.13  @edgeset
    7.14 -                id      capacity
    7.15 +                label      capacity
    7.16  4       5       6       8
    7.17  3       5       5       8
    7.18  2       4       4       5
     8.1 --- a/demo/sub_gad_input.lgf	Thu Jan 19 16:56:39 2006 +0000
     8.2 +++ b/demo/sub_gad_input.lgf	Tue Jan 24 16:07:38 2006 +0000
     8.3 @@ -1,5 +1,5 @@
     8.4  @nodeset 
     8.5 -id
     8.6 +label
     8.7  6
     8.8  5
     8.9  4
    8.10 @@ -8,7 +8,7 @@
    8.11  1
    8.12  0
    8.13  @edgeset 
    8.14 -                id      length
    8.15 +                label      length
    8.16  5       6       9       4
    8.17  4       6       8       2
    8.18  3       5       7       1
     9.1 --- a/demo/undir_components.lgf	Thu Jan 19 16:56:39 2006 +0000
     9.2 +++ b/demo/undir_components.lgf	Tue Jan 24 16:07:38 2006 +0000
     9.3 @@ -1,5 +1,5 @@
     9.4  @nodeset 
     9.5 -coordinates_x	coordinates_y	id	
     9.6 +coordinates_x	coordinates_y	label	
     9.7  574.035	177.301	44	
     9.8  694.579	115.483	43	
     9.9  280.402	10.3938	42	
    9.10 @@ -44,7 +44,7 @@
    9.11  -689.204	-237.261	32	
    9.12  -567.302	43.6423	33	
    9.13  @undiredgeset 
    9.14 -		id	
    9.15 +		label	
    9.16  41	42	44	
    9.17  40	42	43	
    9.18  37	40	49	
    10.1 --- a/doc/graph_io.dox	Thu Jan 19 16:56:39 2006 +0000
    10.2 +++ b/doc/graph_io.dox	Tue Jan 24 16:07:38 2006 +0000
    10.3 @@ -31,13 +31,13 @@
    10.4  
    10.5  The next line contains the names of the nodemaps, separated by whitespaces.  Each
    10.6  following line describes a node in the graph: it contains the values of the
    10.7 -maps in the right order. The map named "id" should contain unique values
    10.8 -because it is regarded as an ID-map. These ids need not be numbers but they
    10.9 +maps in the right order. The map named "label" should contain unique values
   10.10 +because it is regarded as a label map. These labels need not be numbers but they
   10.11  must identify the nodes uniquely for later reference. For example:
   10.12  
   10.13  \code
   10.14  @nodeset
   10.15 -id  x-coord  y-coord  color
   10.16 +label  x-coord  y-coord  color
   10.17  3   1.0      4.0      blue
   10.18  5   2.3      5.7      red
   10.19  12  7.8      2.3      green
   10.20 @@ -50,17 +50,17 @@
   10.21  
   10.22  The next line contains the whitespace separated list of names of the edge
   10.23  maps.  Each of the next lines describes one edge. The first two elements in
   10.24 -the line are the IDs of the source and target (or tail and head) nodes of the
   10.25 -edge as they occur in the ID node map of the nodeset section. You can also
   10.26 -have an optional ID map on the edges for later reference (which has to be
   10.27 +the line are the labels of the source and target (or tail and head) nodes of the
   10.28 +edge as they occur in the label node map of the nodeset section. You can also
   10.29 +have an optional label map on the edges for later reference (which has to be
   10.30  unique in this case).
   10.31  
   10.32  \code
   10.33  @edgeset
   10.34 -             id    weight   label
   10.35 -3   5        a     4.3      a-edge
   10.36 -5   12       c     2.6      c-edge
   10.37 -3   12       g     3.4      g-edge
   10.38 +             label      weight   note
   10.39 +3   5        a          4.3      a-edge
   10.40 +5   12       c          2.6      c-edge
   10.41 +3   12       g          3.4      g-edge
   10.42  \endcode
   10.43  
   10.44  The \e nodes section contains <em>labeled (distinguished) nodes</em> 
   10.45 @@ -70,7 +70,7 @@
   10.46  <tt> \@nodes </tt>
   10.47  
   10.48  Each of the next lines contains a label for a node in the graph 
   10.49 -and then the ID as described in the \e nodeset section.
   10.50 +and then the label as described in the \e nodeset section.
   10.51  
   10.52  \code
   10.53  @nodes 
   10.54 @@ -80,7 +80,7 @@
   10.55  
   10.56  The last section describes the <em>labeled (distinguished) edges</em>
   10.57  (i.e. edges having a special label on them). It starts with \c \@edges
   10.58 -and then each line contains the name of the edge and the ID.
   10.59 +and then each line contains the name of the edge and the label.
   10.60  
   10.61  \code
   10.62  @edges 
   10.63 @@ -103,9 +103,7 @@
   10.64  version 12
   10.65  \endcode
   10.66  
   10.67 -<tt> \@end </tt>
   10.68 -
   10.69 -line.
   10.70 +Finally, the file should be closed with \c \@end line.
   10.71  
   10.72  
   10.73  \section use Using graph input-output
   10.74 @@ -132,14 +130,14 @@
   10.75  function declares a \c NodeMap writing command in the
   10.76  \ref lemon::GraphWriter "GraphWriter".
   10.77  You should give a name to the map and the map
   10.78 -object as parameters. The NodeMap writing command with name "id" should write a 
   10.79 -unique map because it will be regarded as an ID map.
   10.80 +object as parameters. The NodeMap writing command with name "label" should write a 
   10.81 +unique map because it will be regarded as a label map.
   10.82  
   10.83  \see IdMap, DescriptorMap  
   10.84  
   10.85  \code
   10.86 -IdMap<ListGraph, Node> nodeIdMap;
   10.87 -writer.writeNodeMap("id", nodeIdMap);
   10.88 +IdMap<ListGraph, Node> nodeLabelMap;
   10.89 +writer.writeNodeMap("label", nodeLabelMap);
   10.90  
   10.91  writer.writeNodeMap("x-coord", xCoordMap);
   10.92  writer.writeNodeMap("y-coord", yCoordMap);
   10.93 @@ -157,7 +155,7 @@
   10.94  writer.writeEdgeMap("descriptor", edgeDescMap);
   10.95  
   10.96  writer.writeEdgeMap("weight", weightMap);
   10.97 -writer.writeEdgeMap("label", labelMap);
   10.98 +writer.writeEdgeMap("note", noteMap);
   10.99  \endcode
  10.100  
  10.101  With \ref lemon::GraphWriter::writeNode() "writeNode()"
  10.102 @@ -314,10 +312,10 @@
  10.103  The global functionality of the reader class can be changed by giving a
  10.104  special template parameter to the GraphReader class. By default, the
  10.105  template parameter is \c DefaultReaderTraits. A reader traits class 
  10.106 -should provide an inner template class Reader for each type, and a 
  10.107 +should provide a nested template class Reader for each type, and a 
  10.108  DefaultReader for skipping a value.
  10.109  
  10.110 -The specialization of  writing is very similar to that of reading.
  10.111 +The specialization of writing is very similar to that of reading.
  10.112  
  10.113  \section undir Undirected graphs
  10.114  
  10.115 @@ -333,10 +331,10 @@
  10.116  
  10.117  \code
  10.118  @undiredgeset
  10.119 -             id    capacity +flow -flow
  10.120 -32   2       1     4.3      2.0	  0.0
  10.121 -21   21      5     2.6      0.0   2.6
  10.122 -21   12      8     3.4      0.0   0.0
  10.123 +             label      capacity        +flow   -flow
  10.124 +32   2       1          4.3             2.0     0.0
  10.125 +21   21      5          2.6             0.0     2.6
  10.126 +21   12      8          3.4             0.0     0.0
  10.127  \endcode
  10.128  
  10.129  The \c edges section is changed to \c undiredges section. This section
  10.130 @@ -461,7 +459,7 @@
  10.131  Because both the \ref lemon::GraphReader "GraphReader"
  10.132  and the \ref lemon::UndirGraphReader "UndirGraphReader" can be converted
  10.133  to \ref lemon::LemonReader "LemonReader"
  10.134 -and it can resolve the ID's of the items, the previous
  10.135 +and it can resolve the label's of the items, the previous
  10.136  result can be achived with the \ref lemon::UndirGraphReader "UndirGraphReader"
  10.137  class, too.
  10.138  
    11.1 --- a/gui/graphocska.lgf	Thu Jan 19 16:56:39 2006 +0000
    11.2 +++ b/gui/graphocska.lgf	Tue Jan 24 16:07:38 2006 +0000
    11.3 @@ -1,5 +1,5 @@
    11.4  @nodeset
    11.5 -id	coordinates_x	coordinates_y data
    11.6 +label	coordinates_x	coordinates_y data
    11.7  1	230	-80	1.123
    11.8  2	230	100	3.234
    11.9  3	120	-80	5.345
    12.1 --- a/lemon/graph_reader.h	Thu Jan 19 16:56:39 2006 +0000
    12.2 +++ b/lemon/graph_reader.h	Tue Jan 24 16:07:38 2006 +0000
    12.3 @@ -67,8 +67,7 @@
    12.4    /// \code
    12.5    /// reader.readNodeMap("coords", coords);
    12.6    ///
    12.7 -  /// reader.readNodeMap<QuotedStringReader>("label", labelMap);
    12.8 -  /// reader.skipNodeMap<QuotedStringReader>("description");
    12.9 +  /// reader.skipNodeMap("description", desc);
   12.10    ///
   12.11    /// reader.readNodeMap("color", colorMap);
   12.12    /// \endcode
   12.13 @@ -306,20 +305,28 @@
   12.14        reader->run();
   12.15      }
   12.16  
   12.17 -    /// \brief Gives back the node by its id.
   12.18 +
   12.19 +    /// \brief Returns true if the reader can give back the items by its label.
   12.20      ///
   12.21 -    /// It reads an id from the stream and gives back which node belongs to
   12.22 -    /// it. It is possible only if there was read an "id" named node map.
   12.23 -    Node readId(std::istream& is, Node) const {
   12.24 -      return nodeset_reader.readId(is, Node());
   12.25 +    /// \brief Returns true if the reader can give back the items by its label.
   12.26 +    bool isLabelReader() const {
   12.27 +      return nodeset_reader.isLabelReader() && edgeset_reader.isLabelReader();
   12.28 +    }
   12.29 +
   12.30 +    /// \brief Gives back the node by its label.
   12.31 +    ///
   12.32 +    /// It reads an label from the stream and gives back which node belongs to
   12.33 +    /// it. It is possible only if there was read an "label" named node map.
   12.34 +    void readLabel(std::istream& is, Node& node) const {
   12.35 +      nodeset_reader.readLabel(is, node);
   12.36      } 
   12.37  
   12.38 -    /// \brief Gives back the edge by its id.
   12.39 +    /// \brief Gives back the edge by its label.
   12.40      ///
   12.41 -    /// It reads an id from the stream and gives back which edge belongs to
   12.42 -    /// it. It is possible only if there was read an "id" named edge map.
   12.43 -    Edge readId(std::istream& is, Edge) const {
   12.44 -      return edgeset_reader.readId(is, Edge());
   12.45 +    /// It reads an label from the stream and gives back which edge belongs to
   12.46 +    /// it. It is possible only if there was read an "label" named edge map.
   12.47 +    void readLabel(std::istream& is, Edge& edge) const {
   12.48 +      return edgeset_reader.readLabel(is, edge);
   12.49      } 
   12.50  
   12.51    private:
   12.52 @@ -404,8 +411,7 @@
   12.53    /// \code
   12.54    /// reader.readNodeMap("coords", coords);
   12.55    ///
   12.56 -  /// reader.readNodeMap<QuotedStringReader>("label", labelMap);
   12.57 -  /// reader.skipNodeMap<QuotedStringReader>("description");
   12.58 +  /// reader.skipNodeMap("description", desc);
   12.59    ///
   12.60    /// reader.readNodeMap("color", colorMap);
   12.61    /// \endcode
   12.62 @@ -704,29 +710,38 @@
   12.63        reader->run();
   12.64      }
   12.65  
   12.66 -    /// \brief Gives back the node by its id.
   12.67 +
   12.68 +    /// \brief Returns true if the reader can give back the items by its label.
   12.69      ///
   12.70 -    /// It reads an id from the stream and gives back which node belongs to
   12.71 -    /// it. It is possible only if there was read an "id" named node map.
   12.72 -    Node readId(std::istream& is, Node) const {
   12.73 -      return nodeset_reader.readId(is, Node());
   12.74 +    /// \brief Returns true if the reader can give back the items by its label.
   12.75 +    bool isLabelReader() const {
   12.76 +      return nodeset_reader.isLabelReader() && 
   12.77 +        undir_edgeset_reader.isLabelReader();
   12.78 +    }
   12.79 +
   12.80 +    /// \brief Gives back the node by its label.
   12.81 +    ///
   12.82 +    /// It reads an label from the stream and gives back which node belongs to
   12.83 +    /// it. It is possible only if there was read an "label" named node map.
   12.84 +    void readLabel(std::istream& is, Node& node) const {
   12.85 +      return nodeset_reader.readLabel(is, node);
   12.86      } 
   12.87  
   12.88 -    /// \brief Gives back the edge by its id.
   12.89 +    /// \brief Gives back the edge by its label.
   12.90      ///
   12.91 -    /// It reads an id from the stream and gives back which edge belongs to
   12.92 -    /// it. It is possible only if there was read an "id" named edge map.
   12.93 -    Edge readId(std::istream& is, Edge) const {
   12.94 -      return undir_edgeset_reader.readId(is, Edge());
   12.95 +    /// It reads an label from the stream and gives back which edge belongs to
   12.96 +    /// it. It is possible only if there was read an "label" named edge map.
   12.97 +    void readLabel(std::istream& is, Edge& edge) const {
   12.98 +      return undir_edgeset_reader.readLabel(is, edge);
   12.99      } 
  12.100  
  12.101 -    /// \brief Gives back the undirected edge by its id.
  12.102 +    /// \brief Gives back the undirected edge by its label.
  12.103      ///
  12.104 -    /// It reads an id from the stream and gives back which undirected edge 
  12.105 -    /// belongs to it. It is possible only if there was read an "id" named 
  12.106 +    /// It reads an label from the stream and gives back which undirected edge 
  12.107 +    /// belongs to it. It is possible only if there was read an "label" named 
  12.108      /// edge map.
  12.109 -    UndirEdge readId(std::istream& is, UndirEdge) const {
  12.110 -      return undir_edgeset_reader.readId(is, UndirEdge());
  12.111 +    void readLabel(std::istream& is, UndirEdge& uedge) const {
  12.112 +      return undir_edgeset_reader.readLabel(is, uedge);
  12.113      } 
  12.114      
  12.115  
    13.1 --- a/lemon/graph_writer.h	Thu Jan 19 16:56:39 2006 +0000
    13.2 +++ b/lemon/graph_writer.h	Tue Jan 24 16:07:38 2006 +0000
    13.3 @@ -54,12 +54,12 @@
    13.4    /// The \c writeNodeMap() function declares a \c NodeMap writing 
    13.5    /// command in the \c GraphWriter. You should give as parameter 
    13.6    /// the name of the map and the map object. The NodeMap writing 
    13.7 -  /// command with name "id" should write a unique map because it 
    13.8 -  /// is regarded as ID map (such a map is essential if the graph has edges).
    13.9 +  /// command with name "label" should write a unique map because it 
   13.10 +  /// is regarded as label map (such a map is essential if the graph has edges).
   13.11    ///
   13.12    /// \code
   13.13 -  /// IdMap<ListGraph, Node> nodeIdMap;
   13.14 -  /// writer.writeNodeMap("id", nodeIdMap);
   13.15 +  /// IdMap<ListGraph, Node> nodeLabelMap;
   13.16 +  /// writer.writeNodeMap("label", nodeLabelMap);
   13.17    ///
   13.18    /// writer.writeNodeMap("coords", coords);
   13.19    /// writer.writeNodeMap("color", colorMap);
   13.20 @@ -253,20 +253,20 @@
   13.21        writer->run();
   13.22      }
   13.23  
   13.24 -    /// \brief Write the id of the given node.
   13.25 +    /// \brief Write the label of the given node.
   13.26      ///
   13.27 -    /// It writes the id of the given node. If there was written an "id"
   13.28 +    /// It writes the label of the given node. If there was written an "label"
   13.29      /// named node map then it will write the map value belonging to the node.
   13.30 -    void writeId(std::ostream& os, const Node& item) const {
   13.31 -      nodeset_writer.writeId(os, item);
   13.32 +    void writeLabel(std::ostream& os, const Node& item) const {
   13.33 +      nodeset_writer.writeLabel(os, item);
   13.34      } 
   13.35  
   13.36 -    /// \brief Write the id of the given edge.
   13.37 +    /// \brief Write the label of the given edge.
   13.38      ///
   13.39 -    /// It writes the id of the given edge. If there was written an "id"
   13.40 +    /// It writes the label of the given edge. If there was written an "label"
   13.41      /// named edge map then it will write the map value belonging to the edge.
   13.42 -    void writeId(std::ostream& os, const Edge& item) const {
   13.43 -      edgeset_writer.writeId(os, item);
   13.44 +    void writeLabel(std::ostream& os, const Edge& item) const {
   13.45 +      edgeset_writer.writeLabel(os, item);
   13.46      } 
   13.47  
   13.48    private:
   13.49 @@ -327,12 +327,12 @@
   13.50    /// The \c writeNodeMap() function declares a \c NodeMap writing 
   13.51    /// command in the \c UndirGraphWriter. You should give as parameter 
   13.52    /// the name of the map and the map object. The NodeMap writing 
   13.53 -  /// command with name "id" should write a unique map because it 
   13.54 -  /// is regarded as ID map.
   13.55 +  /// command with name "label" should write a unique map because it 
   13.56 +  /// is regarded as label map.
   13.57    ///
   13.58    /// \code
   13.59 -  /// IdMap<UndirListGraph, Node> nodeIdMap;
   13.60 -  /// writer.writeNodeMap("id", nodeIdMap);
   13.61 +  /// IdMap<UndirListGraph, Node> nodeLabelMap;
   13.62 +  /// writer.writeNodeMap("label", nodeLabelMap);
   13.63    ///
   13.64    /// writer.writeNodeMap("coords", coords);
   13.65    /// writer.writeNodeMap("color", colorMap);
   13.66 @@ -561,29 +561,29 @@
   13.67        writer->run();
   13.68      }
   13.69  
   13.70 -    /// \brief Write the id of the given node.
   13.71 +    /// \brief Write the label of the given node.
   13.72      ///
   13.73 -    /// It writes the id of the given node. If there was written an "id"
   13.74 +    /// It writes the label of the given node. If there was written an "label"
   13.75      /// named node map then it will write the map value belonging to the node.
   13.76 -    void writeId(std::ostream& os, const Node& item) const {
   13.77 -      nodeset_writer.writeId(os, item);
   13.78 +    void writeLabel(std::ostream& os, const Node& item) const {
   13.79 +      nodeset_writer.writeLabel(os, item);
   13.80      } 
   13.81  
   13.82 -    /// \brief Write the id of the given edge.
   13.83 +    /// \brief Write the label of the given edge.
   13.84      ///
   13.85 -    /// It writes the id of the given edge. If there was written an "id"
   13.86 +    /// It writes the label of the given edge. If there was written an "label"
   13.87      /// named edge map then it will write the map value belonging to the edge.
   13.88 -    void writeId(std::ostream& os, const Edge& item) const {
   13.89 -      undir_edgeset_writer.writeId(os, item);
   13.90 +    void writeLabel(std::ostream& os, const Edge& item) const {
   13.91 +      undir_edgeset_writer.writeLabel(os, item);
   13.92      } 
   13.93  
   13.94 -    /// \brief Write the id of the given undirected edge.
   13.95 +    /// \brief Write the label of the given undirected edge.
   13.96      ///
   13.97 -    /// It writes the id of the given undirected edge. If there was written 
   13.98 -    /// an "id" named edge map then it will write the map value belonging to 
   13.99 +    /// It writes the label of the given undirected edge. If there was written 
  13.100 +    /// an "label" named edge map then it will write the map value belonging to 
  13.101      /// the edge.
  13.102 -    void writeId(std::ostream& os, const UndirEdge& item) const {
  13.103 -      undir_edgeset_writer.writeId(os, item);
  13.104 +    void writeLabel(std::ostream& os, const UndirEdge& item) const {
  13.105 +      undir_edgeset_writer.writeLabel(os, item);
  13.106      } 
  13.107  
  13.108  
    14.1 --- a/lemon/lemon_reader.h	Thu Jan 19 16:56:39 2006 +0000
    14.2 +++ b/lemon/lemon_reader.h	Tue Jan 24 16:07:38 2006 +0000
    14.3 @@ -47,7 +47,7 @@
    14.4  
    14.5      template <typename T>
    14.6      bool operator<(T, T) {
    14.7 -      throw DataFormatError("Id is not comparable");
    14.8 +      throw DataFormatError("Label is not comparable");
    14.9      }
   14.10  
   14.11      template <typename T>
   14.12 @@ -58,22 +58,22 @@
   14.13      };
   14.14  
   14.15      template <typename Item>
   14.16 -    class ItemIdReader {
   14.17 +    class ItemLabelReader {
   14.18      public:
   14.19  
   14.20 -      bool isIdReader() { return true; }
   14.21 +      bool isLabelReader() { return true; }
   14.22  
   14.23 -      void readId(std::istream&, Item&) {}
   14.24 +      void readLabel(std::istream&, Item&) {}
   14.25        
   14.26 -      template <class _ItemIdReader>
   14.27 +      template <class _ItemLabelReader>
   14.28        struct Constraints {
   14.29  	void constraints() {
   14.30 -	  bool b = reader.isIdReader();
   14.31 +	  bool b = reader.isLabelReader();
   14.32  	  ignore_unused_variable_warning(b);
   14.33  	  Item item;
   14.34 -	  reader.readId(is, item);
   14.35 +	  reader.readLabel(is, item);
   14.36  	}
   14.37 -	_ItemIdReader& reader;
   14.38 +	_ItemLabelReader& reader;
   14.39  	std::istream& is;
   14.40        };
   14.41  
   14.42 @@ -241,7 +241,7 @@
   14.43  	if (it == inverse.end()) {
   14.44  	  inverse.insert(std::make_pair(value, item));
   14.45  	} else {
   14.46 -	  throw DataFormatError("Multiple ID occurence");
   14.47 +	  throw DataFormatError("Multiple label occurence");
   14.48  	}
   14.49        }
   14.50  
   14.51 @@ -252,7 +252,7 @@
   14.52  	if (it != inverse.end()) {
   14.53  	  return it->second;
   14.54  	} else {
   14.55 -	  throw DataFormatError("Invalid ID error");
   14.56 +	  throw DataFormatError("Invalid label error");
   14.57  	}
   14.58        }      
   14.59      };
   14.60 @@ -279,7 +279,7 @@
   14.61  	if (it == inverse.end()) {
   14.62  	  inverse.insert(std::make_pair(value, item));
   14.63  	} else {
   14.64 -	  throw DataFormatError("Multiple ID occurence error");
   14.65 +	  throw DataFormatError("Multiple label occurence error");
   14.66  	}
   14.67        }
   14.68  
   14.69 @@ -290,7 +290,7 @@
   14.70  	if (it != inverse.end()) {
   14.71  	  return it->second;
   14.72  	} else {
   14.73 -	  throw DataFormatError("Invalid ID error");
   14.74 +	  throw DataFormatError("Invalid label error");
   14.75  	}
   14.76        }
   14.77  
   14.78 @@ -370,33 +370,33 @@
   14.79      };
   14.80  
   14.81      template <typename _Item>
   14.82 -    class IdReaderBase {
   14.83 +    class LabelReaderBase {
   14.84      public:
   14.85        typedef _Item Item;
   14.86 -      virtual ~IdReaderBase() {}
   14.87 +      virtual ~LabelReaderBase() {}
   14.88        virtual Item read(std::istream& is) const = 0;
   14.89 -      virtual bool isIdReader() const = 0;
   14.90 +      virtual bool isLabelReader() const = 0;
   14.91      };
   14.92  
   14.93 -    template <typename _Item, typename _BoxedIdReader>
   14.94 -    class IdReader : public IdReaderBase<_Item> {
   14.95 +    template <typename _Item, typename _BoxedLabelReader>
   14.96 +    class LabelReader : public LabelReaderBase<_Item> {
   14.97      public:
   14.98        typedef _Item Item;
   14.99 -      typedef _BoxedIdReader BoxedIdReader;
  14.100 +      typedef _BoxedLabelReader BoxedLabelReader;
  14.101        
  14.102 -      const BoxedIdReader& boxedIdReader;
  14.103 +      const BoxedLabelReader& boxedLabelReader;
  14.104  
  14.105 -      IdReader(const BoxedIdReader& _boxedIdReader) 
  14.106 -	: boxedIdReader(_boxedIdReader) {}
  14.107 +      LabelReader(const BoxedLabelReader& _boxedLabelReader) 
  14.108 +	: boxedLabelReader(_boxedLabelReader) {}
  14.109  
  14.110        virtual Item read(std::istream& is) const {
  14.111  	Item item;
  14.112 -	boxedIdReader.readId(is, item);
  14.113 +	boxedLabelReader.readLabel(is, item);
  14.114  	return item;
  14.115        }
  14.116  
  14.117 -      virtual bool isIdReader() const {
  14.118 -	return boxedIdReader.isIdReader();
  14.119 +      virtual bool isLabelReader() const {
  14.120 +	return boxedLabelReader.isLabelReader();
  14.121        }
  14.122      };
  14.123  
  14.124 @@ -727,16 +727,16 @@
  14.125    /// \brief SectionReader for reading a graph's nodeset.
  14.126    ///
  14.127    /// The lemon format can store multiple graph nodesets with several maps.
  14.128 -  /// The nodeset section's header line is \c \@nodeset \c nodeset_id, but the
  14.129 -  /// \c nodeset_id may be empty.
  14.130 +  /// The nodeset section's header line is \c \@nodeset \c nodeset_name, but the
  14.131 +  /// \c nodeset_name may be empty.
  14.132    ///
  14.133    /// The first line of the section contains the names of the maps separated
  14.134    /// with white spaces. Each next lines describes a node in the nodeset, and
  14.135    /// contains the mapped values for each map.
  14.136    ///
  14.137 -  /// If the nodeset contains an \c "id" named map then it will be regarded
  14.138 +  /// If the nodeset contains an \c "label" named map then it will be regarded
  14.139    /// as id map. This map should contain only unique values and when the 
  14.140 -  /// \c readId() member will read a value from the given stream it will
  14.141 +  /// \c readLabel() member will read a value from the given stream it will
  14.142    /// give back that node which is mapped to this value.
  14.143    ///
  14.144    /// \relates LemonReader
  14.145 @@ -755,12 +755,12 @@
  14.146      /// Constructor for NodeSetReader. It creates the NodeSetReader and
  14.147      /// attach it into the given LemonReader. The nodeset reader will
  14.148      /// add the readed nodes to the given Graph. The reader will read
  14.149 -    /// the section when the \c section_id and the \c _id are the same. 
  14.150 +    /// the section when the \c section_name and the \c _name are the same. 
  14.151      NodeSetReader(LemonReader& _reader, 
  14.152  		  Graph& _graph, 
  14.153 -		  const std::string& _id = std::string(),
  14.154 +		  const std::string& _name = std::string(),
  14.155  		  const DefaultSkipper& _skipper = DefaultSkipper()) 
  14.156 -      : Parent(_reader), graph(_graph), id(_id), skipper(_skipper) {} 
  14.157 +      : Parent(_reader), graph(_graph), name(_name), skipper(_skipper) {} 
  14.158  
  14.159  
  14.160      /// \brief Destructor.
  14.161 @@ -855,11 +855,11 @@
  14.162      /// the section with the given header line.
  14.163      ///
  14.164      /// It gives back true when the header line starts with \c \@nodeset,
  14.165 -    /// and the header line's id and the nodeset's id are the same.
  14.166 +    /// and the header line's name and the nodeset's name are the same.
  14.167      virtual bool header(const std::string& line) {
  14.168        std::istringstream ls(line);
  14.169        std::string command;
  14.170 -      std::string name;
  14.171 +      std::string id;
  14.172        ls >> command >> name;
  14.173        return command == "@nodeset" && name == id;
  14.174      }
  14.175 @@ -872,7 +872,8 @@
  14.176        std::string line;
  14.177  
  14.178        getline(is, line);
  14.179 -      std::istringstream ls(line);	
  14.180 +      std::istringstream ls(line);
  14.181 +      std::string id;
  14.182        while (ls >> id) {
  14.183  	typename MapReaders::iterator it = readers.find(id);
  14.184  	if (it != readers.end()) {
  14.185 @@ -881,7 +882,7 @@
  14.186  	} else {
  14.187  	  index.push_back(&skipper);
  14.188  	}
  14.189 -	if (id == "id" && inverter.get() == 0) {
  14.190 +	if (id == "label" || (id =="id" && inverter.get() == 0)) {
  14.191  	  inverter.reset(index.back()->getInverter());
  14.192  	  index.back() = inverter.get();
  14.193  	}
  14.194 @@ -905,19 +906,19 @@
  14.195  
  14.196    public:
  14.197  
  14.198 -    /// \brief Returns true if the nodeset can give back the node by its id.
  14.199 +    /// \brief Returns true if the nodeset can give back the node by its label.
  14.200      ///
  14.201 -    /// Returns true if the nodeset can give back the node by its id.
  14.202 -    /// It is possible only if an "id" named map was read.
  14.203 -    bool isIdReader() const {
  14.204 +    /// Returns true if the nodeset can give back the node by its label.
  14.205 +    /// It is possible only if an "label" named map was read.
  14.206 +    bool isLabelReader() const {
  14.207        return inverter.get() != 0;
  14.208      }
  14.209  
  14.210 -    /// \brief Gives back the node by its id.
  14.211 +    /// \brief Gives back the node by its label.
  14.212      ///
  14.213      /// It reads an id from the stream and gives back which node belongs to
  14.214 -    /// it. It is possible only if there was read an "id" named map.
  14.215 -    void readId(std::istream& is, Node& node) const {
  14.216 +    /// it. It is possible only if there was read an "label" named map.
  14.217 +    void readLabel(std::istream& is, Node& node) const {
  14.218        node = inverter->read(is);
  14.219      } 
  14.220  
  14.221 @@ -927,7 +928,7 @@
  14.222      MapReaders readers;
  14.223     
  14.224      Graph& graph;   
  14.225 -    std::string id;
  14.226 +    std::string name;
  14.227      _reader_bits::SkipReader<Node, DefaultSkipper> skipper;
  14.228  
  14.229      std::auto_ptr<_reader_bits::MapInverterBase<Node> > inverter;
  14.230 @@ -937,21 +938,21 @@
  14.231    /// \brief SectionReader for reading a graph's edgeset.
  14.232    ///
  14.233    /// The lemon format can store multiple graph edgesets with several maps.
  14.234 -  /// The edgeset section's header line is \c \@edgeset \c edgeset_id, but the
  14.235 -  /// \c edgeset_id may be empty.
  14.236 +  /// The edgeset section's header line is \c \@edgeset \c edgeset_name, but the
  14.237 +  /// \c edgeset_name may be empty.
  14.238    ///
  14.239    /// The first line of the section contains the names of the maps separated
  14.240    /// with white spaces. Each next lines describes an edge in the edgeset. The
  14.241    /// line contains the source and the target nodes' id and the mapped 
  14.242    /// values for each map.
  14.243    ///
  14.244 -  /// If the edgeset contains an \c "id" named map then it will be regarded
  14.245 +  /// If the edgeset contains an \c "label" named map then it will be regarded
  14.246    /// as id map. This map should contain only unique values and when the 
  14.247 -  /// \c readId() member will read a value from the given stream it will
  14.248 +  /// \c readLabel() member will read a value from the given stream it will
  14.249    /// give back that edge which is mapped to this value.
  14.250    ///
  14.251    /// The edgeset reader needs a node id reader to identify which nodes
  14.252 -  /// have to be connected. If a NodeSetReader reads an "id" named map,
  14.253 +  /// have to be connected. If a NodeSetReader reads an "label" named map,
  14.254    /// it will be able to resolve the nodes by ids.
  14.255    ///
  14.256    /// \relates LemonReader
  14.257 @@ -972,18 +973,18 @@
  14.258      /// attach it into the given LemonReader. The edgeset reader will
  14.259      /// add the readed edges to the given Graph. It will use the given
  14.260      /// node id reader to read the source and target nodes of the edges.
  14.261 -    /// The reader will read the section only if the \c _id and the 
  14.262 -    /// \c edgset_id are the same. 
  14.263 -    template <typename NodeIdReader>
  14.264 +    /// The reader will read the section only if the \c _name and the 
  14.265 +    /// \c edgset_name are the same. 
  14.266 +    template <typename NodeLabelReader>
  14.267      EdgeSetReader(LemonReader& _reader, 
  14.268  		  Graph& _graph, 
  14.269 -		  const NodeIdReader& _nodeIdReader, 
  14.270 -		  const std::string& _id = std::string(),
  14.271 +		  const NodeLabelReader& _nodeLabelReader, 
  14.272 +		  const std::string& _name = std::string(),
  14.273  		  const DefaultSkipper& _skipper = DefaultSkipper()) 
  14.274 -      : Parent(_reader), graph(_graph), id(_id), skipper(_skipper) {
  14.275 -      checkConcept<_reader_bits::ItemIdReader<Node>, NodeIdReader>();
  14.276 -      nodeIdReader.reset(new _reader_bits::
  14.277 -			 IdReader<Node, NodeIdReader>(_nodeIdReader));
  14.278 +      : Parent(_reader), graph(_graph), name(_name), skipper(_skipper) {
  14.279 +      checkConcept<_reader_bits::ItemLabelReader<Node>, NodeLabelReader>();
  14.280 +      nodeLabelReader.reset(new _reader_bits::
  14.281 +			 LabelReader<Node, NodeLabelReader>(_nodeLabelReader));
  14.282      }
  14.283      /// \brief Destructor.
  14.284      ///
  14.285 @@ -1077,11 +1078,11 @@
  14.286      /// the section with the given header line.
  14.287      ///
  14.288      /// It gives back true when the header line starts with \c \@edgeset,
  14.289 -    /// and the header line's id and the edgeset's id are the same.
  14.290 +    /// and the header line's name and the edgeset's name are the same.
  14.291      virtual bool header(const std::string& line) {
  14.292        std::istringstream ls(line);
  14.293        std::string command;
  14.294 -      std::string name;
  14.295 +      std::string id;
  14.296        ls >> command >> name;
  14.297        return command == "@edgeset" && name == id;
  14.298      }
  14.299 @@ -1090,14 +1091,15 @@
  14.300      ///
  14.301      /// It reads the content of the section.
  14.302      virtual void read(std::istream& is) {
  14.303 -      if (!nodeIdReader->isIdReader()) {
  14.304 -	throw DataFormatError("Cannot find nodeset or ID map");
  14.305 +      if (!nodeLabelReader->isLabelReader()) {
  14.306 +	throw DataFormatError("Cannot find nodeset or label map");
  14.307        }
  14.308        std::vector<_reader_bits::MapReaderBase<Edge>* > index;
  14.309        std::string line;
  14.310  
  14.311        getline(is, line);
  14.312        std::istringstream ls(line);	
  14.313 +      std::string id;
  14.314        while (ls >> id) {
  14.315  	typename MapReaders::iterator it = readers.find(id);
  14.316  	if (it != readers.end()) {
  14.317 @@ -1106,7 +1108,7 @@
  14.318  	} else {
  14.319  	  index.push_back(&skipper);
  14.320  	}
  14.321 -	if (id == "id" && inverter.get() == 0) {
  14.322 +	if (id == "label" || (id =="id" && inverter.get() == 0)) {
  14.323  	  inverter.reset(index.back()->getInverter());
  14.324  	  index.back() = inverter.get();
  14.325  	}
  14.326 @@ -1121,8 +1123,8 @@
  14.327        }
  14.328        while (getline(is, line)) {	
  14.329  	std::istringstream ls(line);
  14.330 -	Node from = nodeIdReader->read(ls);
  14.331 -	Node to = nodeIdReader->read(ls);
  14.332 +	Node from = nodeLabelReader->read(ls);
  14.333 +	Node to = nodeLabelReader->read(ls);
  14.334  	Edge edge = graph.addEdge(from, to);
  14.335  	for (int i = 0; i < (int)index.size(); ++i) {
  14.336  	  index[i]->read(ls, edge);
  14.337 @@ -1132,19 +1134,19 @@
  14.338  
  14.339    public:
  14.340  
  14.341 -    /// \brief Returns true if the edgeset can give back the edge by its id.
  14.342 +    /// \brief Returns true if the edgeset can give back the edge by its label.
  14.343      ///
  14.344 -    /// Returns true if the edgeset can give back the edge by its id.
  14.345 -    /// It is possible only if an "id" named map was read.
  14.346 -    bool isIdReader() const {
  14.347 +    /// Returns true if the edgeset can give back the edge by its label.
  14.348 +    /// It is possible only if an "label" named map was read.
  14.349 +    bool isLabelReader() const {
  14.350        return inverter.get() != 0;
  14.351      }
  14.352  
  14.353 -    /// \brief Gives back the edge by its id.
  14.354 +    /// \brief Gives back the edge by its label.
  14.355      ///
  14.356      /// It reads an id from the stream and gives back which edge belongs to
  14.357 -    /// it. It is possible only if there was read an "id" named map.
  14.358 -    void readId(std::istream& is, Edge& edge) const {
  14.359 +    /// it. It is possible only if there was read an "label" named map.
  14.360 +    void readLabel(std::istream& is, Edge& edge) const {
  14.361        edge = inverter->read(is);
  14.362      } 
  14.363  
  14.364 @@ -1154,11 +1156,11 @@
  14.365      MapReaders readers;
  14.366     
  14.367      Graph& graph;   
  14.368 -    std::string id;
  14.369 +    std::string name;
  14.370      _reader_bits::SkipReader<Edge, DefaultSkipper> skipper;
  14.371  
  14.372      std::auto_ptr<_reader_bits::MapInverterBase<Edge> > inverter;
  14.373 -    std::auto_ptr<_reader_bits::IdReaderBase<Node> > nodeIdReader;
  14.374 +    std::auto_ptr<_reader_bits::LabelReaderBase<Node> > nodeLabelReader;
  14.375    };
  14.376  
  14.377    /// \ingroup io_group
  14.378 @@ -1166,7 +1168,7 @@
  14.379    ///
  14.380    /// The lemon format can store multiple undirected edgesets with several 
  14.381    /// maps. The undirected edgeset section's header line is \c \@undiredgeset 
  14.382 -  /// \c undiredgeset_id, but the \c undiredgeset_id may be empty.
  14.383 +  /// \c undiredgeset_name, but the \c undiredgeset_name may be empty.
  14.384    ///
  14.385    /// The first line of the section contains the names of the maps separated
  14.386    /// with white spaces. Each next lines describes an edge in the edgeset. The
  14.387 @@ -1178,13 +1180,13 @@
  14.388    /// is near the same just with a prefix \c '+' or \c '-' character 
  14.389    /// difference.
  14.390    ///
  14.391 -  /// If the edgeset contains an \c "id" named map then it will be regarded
  14.392 +  /// If the edgeset contains an \c "label" named map then it will be regarded
  14.393    /// as id map. This map should contain only unique values and when the 
  14.394 -  /// \c readId() member will read a value from the given stream it will
  14.395 +  /// \c readLabel() member will read a value from the given stream it will
  14.396    /// give back that undiricted edge which is mapped to this value.
  14.397    ///
  14.398    /// The undirected edgeset reader needs a node id reader to identify which 
  14.399 -  /// nodes have to be connected. If a NodeSetReader reads an "id" named map,
  14.400 +  /// nodes have to be connected. If a NodeSetReader reads an "label" named map,
  14.401    /// it will be able to resolve the nodes by ids.
  14.402    ///
  14.403    /// \relates LemonReader
  14.404 @@ -1207,17 +1209,17 @@
  14.405      /// reader will add the readed undirected edges to the given Graph. It 
  14.406      /// will use the given node id reader to read the source and target 
  14.407      /// nodes of the edges. The reader will read the section only if the 
  14.408 -    /// \c _id and the \c undiredgset_id are the same. 
  14.409 -    template <typename NodeIdReader>
  14.410 +    /// \c _name and the \c undiredgset_name are the same. 
  14.411 +    template <typename NodeLabelReader>
  14.412      UndirEdgeSetReader(LemonReader& _reader, 
  14.413  		       Graph& _graph, 
  14.414 -		       const NodeIdReader& _nodeIdReader, 
  14.415 -		       const std::string& _id = std::string(),
  14.416 +		       const NodeLabelReader& _nodeLabelReader, 
  14.417 +		       const std::string& _name = std::string(),
  14.418  		       const DefaultSkipper& _skipper = DefaultSkipper()) 
  14.419 -      : Parent(_reader), graph(_graph), id(_id), skipper(_skipper) {
  14.420 -      checkConcept<_reader_bits::ItemIdReader<Node>, NodeIdReader>();
  14.421 -      nodeIdReader.reset(new _reader_bits::
  14.422 -			 IdReader<Node, NodeIdReader>(_nodeIdReader));
  14.423 +      : Parent(_reader), graph(_graph), name(_name), skipper(_skipper) {
  14.424 +      checkConcept<_reader_bits::ItemLabelReader<Node>, NodeLabelReader>();
  14.425 +      nodeLabelReader.reset(new _reader_bits::
  14.426 +			 LabelReader<Node, NodeLabelReader>(_nodeLabelReader));
  14.427      }
  14.428      /// \brief Destructor.
  14.429      ///
  14.430 @@ -1372,11 +1374,11 @@
  14.431      /// the section with the given header line.
  14.432      ///
  14.433      /// It gives back true when the header line starts with \c \@undiredgeset,
  14.434 -    /// and the header line's id and the edgeset's id are the same.
  14.435 +    /// and the header line's name and the edgeset's name are the same.
  14.436      virtual bool header(const std::string& line) {
  14.437        std::istringstream ls(line);
  14.438        std::string command;
  14.439 -      std::string name;
  14.440 +      std::string id;
  14.441        ls >> command >> name;
  14.442        return command == "@undiredgeset" && name == id;
  14.443      }
  14.444 @@ -1385,14 +1387,15 @@
  14.445      ///
  14.446      /// It reads the content of the section.
  14.447      virtual void read(std::istream& is) {
  14.448 -      if (!nodeIdReader->isIdReader()) {
  14.449 -	throw DataFormatError("Cannot find nodeset or ID map");
  14.450 +      if (!nodeLabelReader->isLabelReader()) {
  14.451 +	throw DataFormatError("Cannot find nodeset or label map");
  14.452        }
  14.453        std::vector<_reader_bits::MapReaderBase<UndirEdge>* > index;
  14.454        std::string line;
  14.455  
  14.456        getline(is, line);
  14.457        std::istringstream ls(line);	
  14.458 +      std::string id;
  14.459        while (ls >> id) {
  14.460  	typename MapReaders::iterator it = readers.find(id);
  14.461  	if (it != readers.end()) {
  14.462 @@ -1401,7 +1404,7 @@
  14.463  	} else {
  14.464  	  index.push_back(&skipper);
  14.465  	}
  14.466 -	if (id == "id" && inverter.get() == 0) {
  14.467 +	if (id == "label" || (id =="id" && inverter.get() == 0)) {
  14.468  	  inverter.reset(index.back()->getInverter());
  14.469  	  index.back() = inverter.get();
  14.470  	}
  14.471 @@ -1416,8 +1419,8 @@
  14.472        }
  14.473        while (getline(is, line)) {	
  14.474  	std::istringstream ls(line);
  14.475 -	Node from = nodeIdReader->read(ls);
  14.476 -	Node to = nodeIdReader->read(ls);
  14.477 +	Node from = nodeLabelReader->read(ls);
  14.478 +	Node to = nodeLabelReader->read(ls);
  14.479  	UndirEdge edge = graph.addEdge(from, to);
  14.480  	for (int i = 0; i < (int)index.size(); ++i) {
  14.481  	  index[i]->read(ls, edge);
  14.482 @@ -1427,29 +1430,29 @@
  14.483  
  14.484    public:
  14.485  
  14.486 -    /// \brief Returns true if the edgeset can give back the edge by its id.
  14.487 +    /// \brief Returns true if the edgeset can give back the edge by its label.
  14.488      ///
  14.489      /// Returns true if the edgeset can give back the undirected edge by its 
  14.490 -    /// id. It is possible only if an "id" named map was read.
  14.491 -    bool isIdReader() const {
  14.492 +    /// id. It is possible only if an "label" named map was read.
  14.493 +    bool isLabelReader() const {
  14.494        return inverter.get() != 0;
  14.495      }
  14.496  
  14.497 -    /// \brief Gives back the undirected edge by its id.
  14.498 +    /// \brief Gives back the undirected edge by its label.
  14.499      ///
  14.500      /// It reads an id from the stream and gives back which undirected edge 
  14.501 -    /// belongs to it. It is possible only if there was read an "id" named map.
  14.502 -    void readId(std::istream& is, UndirEdge& undirEdge) const {
  14.503 +    /// belongs to it. It is possible only if there was read an "label" named map.
  14.504 +    void readLabel(std::istream& is, UndirEdge& undirEdge) const {
  14.505        undirEdge = inverter->read(is);
  14.506      } 
  14.507  
  14.508 -    /// \brief Gives back the directed edge by its id.
  14.509 +    /// \brief Gives back the directed edge by its label.
  14.510      ///
  14.511      /// It reads an id from the stream and gives back which directed edge 
  14.512      /// belongs to it. The directed edge id is the \c '+' or \c '-' character
  14.513      /// and the undirected edge id. It is possible only if there was read 
  14.514 -    /// an "id" named map.
  14.515 -    void readId(std::istream& is, Edge& edge) const {
  14.516 +    /// an "label" named map.
  14.517 +    void readLabel(std::istream& is, Edge& edge) const {
  14.518        char c;
  14.519        is >> c;
  14.520        UndirEdge undirEdge = inverter->read(is);
  14.521 @@ -1470,18 +1473,18 @@
  14.522      MapReaders readers;
  14.523     
  14.524      Graph& graph;   
  14.525 -    std::string id;
  14.526 +    std::string name;
  14.527      _reader_bits::SkipReader<UndirEdge, DefaultSkipper> skipper;
  14.528  
  14.529      std::auto_ptr<_reader_bits::MapInverterBase<UndirEdge> > inverter;
  14.530 -    std::auto_ptr<_reader_bits::IdReaderBase<Node> > nodeIdReader;
  14.531 +    std::auto_ptr<_reader_bits::LabelReaderBase<Node> > nodeLabelReader;
  14.532    };
  14.533  
  14.534    /// \ingroup io_group
  14.535    /// \brief SectionReader for reading labeled nodes.
  14.536    ///
  14.537 -  /// The nodes section's header line is \c \@nodes \c nodes_id, but the
  14.538 -  /// \c nodes_id may be empty.
  14.539 +  /// The nodes section's header line is \c \@nodes \c nodes_name, but the
  14.540 +  /// \c nodes_name may be empty.
  14.541    ///
  14.542    /// Each line in the section contains the name of the node 
  14.543    /// and then the node id. 
  14.544 @@ -1499,14 +1502,14 @@
  14.545      /// Constructor for NodeReader. It creates the NodeReader and
  14.546      /// attach it into the given LemonReader. It will use the given
  14.547      /// node id reader to give back the nodes. The reader will read the 
  14.548 -    /// section only if the \c _id and the \c nodes_id are the same. 
  14.549 -    template <typename _IdReader>
  14.550 -    NodeReader(LemonReader& _reader, const _IdReader& _idReader, 
  14.551 -	       const std::string& _id = std::string()) 
  14.552 -      : Parent(_reader), id(_id) {
  14.553 -      checkConcept<_reader_bits::ItemIdReader<Node>, _IdReader>();
  14.554 -      nodeIdReader.reset(new _reader_bits::
  14.555 -			 IdReader<Node, _IdReader>(_idReader));
  14.556 +    /// section only if the \c _name and the \c nodes_name are the same. 
  14.557 +    template <typename _LabelReader>
  14.558 +    NodeReader(LemonReader& _reader, const _LabelReader& _labelReader, 
  14.559 +	       const std::string& _name = std::string()) 
  14.560 +      : Parent(_reader), name(_name) {
  14.561 +      checkConcept<_reader_bits::ItemLabelReader<Node>, _LabelReader>();
  14.562 +      nodeLabelReader.reset(new _reader_bits::
  14.563 +			 LabelReader<Node, _LabelReader>(_labelReader));
  14.564      }
  14.565  
  14.566      /// \brief Destructor.
  14.567 @@ -1538,11 +1541,11 @@
  14.568      /// the section with the given header line.
  14.569      ///
  14.570      /// It gives back true when the header line start with \c \@nodes,
  14.571 -    /// and the header line's id and the reader's id are the same.
  14.572 +    /// and the header line's name and the reader's name are the same.
  14.573      virtual bool header(const std::string& line) {
  14.574        std::istringstream ls(line);
  14.575        std::string command;
  14.576 -      std::string name;
  14.577 +      std::string id;
  14.578        ls >> command >> name;
  14.579        return command == "@nodes" && name == id;
  14.580      }
  14.581 @@ -1551,8 +1554,8 @@
  14.582      ///
  14.583      /// It reads the content of the section.
  14.584      virtual void read(std::istream& is) {
  14.585 -      if (!nodeIdReader->isIdReader()) {
  14.586 -	throw DataFormatError("Cannot find nodeset or ID map");
  14.587 +      if (!nodeLabelReader->isLabelReader()) {
  14.588 +	throw DataFormatError("Cannot find nodeset or label map");
  14.589        }
  14.590        std::string line;
  14.591        while (getline(is, line)) {
  14.592 @@ -1561,7 +1564,7 @@
  14.593  	ls >> id;
  14.594  	typename NodeReaders::iterator it = readers.find(id);
  14.595  	if (it != readers.end()) {
  14.596 -	  it->second.read(nodeIdReader->read(ls));
  14.597 +	  it->second.read(nodeLabelReader->read(ls));
  14.598  	  it->second.touch();
  14.599  	}	
  14.600        }
  14.601 @@ -1577,18 +1580,18 @@
  14.602      
  14.603    private:
  14.604  
  14.605 -    std::string id;
  14.606 +    std::string name;
  14.607  
  14.608      typedef std::map<std::string, _reader_bits::ItemStore<Node> > NodeReaders;
  14.609      NodeReaders readers;
  14.610 -    std::auto_ptr<_reader_bits::IdReaderBase<Node> > nodeIdReader;
  14.611 +    std::auto_ptr<_reader_bits::LabelReaderBase<Node> > nodeLabelReader;
  14.612    };
  14.613  
  14.614    /// \ingroup io_group
  14.615    /// \brief SectionReader for reading labeled edges.
  14.616    ///
  14.617 -  /// The edges section's header line is \c \@edges \c edges_id, but the
  14.618 -  /// \c edges_id may be empty.
  14.619 +  /// The edges section's header line is \c \@edges \c edges_name, but the
  14.620 +  /// \c edges_name may be empty.
  14.621    ///
  14.622    /// Each line in the section contains the name of the edge 
  14.623    /// and then the edge id. 
  14.624 @@ -1606,14 +1609,14 @@
  14.625      /// Constructor for EdgeReader. It creates the EdgeReader and
  14.626      /// attach it into the given LemonReader. It will use the given
  14.627      /// edge id reader to give back the edges. The reader will read the 
  14.628 -    /// section only if the \c _id and the \c edges_id are the same. 
  14.629 -    template <typename _IdReader>
  14.630 -    EdgeReader(LemonReader& _reader, const _IdReader& _idReader, 
  14.631 -	       const std::string& _id = std::string()) 
  14.632 -      : Parent(_reader), id(_id) {
  14.633 -      checkConcept<_reader_bits::ItemIdReader<Edge>, _IdReader>();
  14.634 -      edgeIdReader.reset(new _reader_bits::
  14.635 -			 IdReader<Edge, _IdReader>(_idReader));
  14.636 +    /// section only if the \c _name and the \c edges_name are the same. 
  14.637 +    template <typename _LabelReader>
  14.638 +    EdgeReader(LemonReader& _reader, const _LabelReader& _labelReader, 
  14.639 +	       const std::string& _name = std::string()) 
  14.640 +      : Parent(_reader), name(_name) {
  14.641 +      checkConcept<_reader_bits::ItemLabelReader<Edge>, _LabelReader>();
  14.642 +      edgeLabelReader.reset(new _reader_bits::
  14.643 +			 LabelReader<Edge, _LabelReader>(_labelReader));
  14.644      }
  14.645  
  14.646      /// \brief Destructor.
  14.647 @@ -1644,11 +1647,11 @@
  14.648      /// the section with the given header line.
  14.649      ///
  14.650      /// It gives back true when the header line start with \c \@edges,
  14.651 -    /// and the header line's id and the reader's id are the same.
  14.652 +    /// and the header line's name and the reader's name are the same.
  14.653      virtual bool header(const std::string& line) {
  14.654        std::istringstream ls(line);
  14.655        std::string command;
  14.656 -      std::string name;
  14.657 +      std::string id;
  14.658        ls >> command >> name;
  14.659        return command == "@edges" && name == id;
  14.660      }
  14.661 @@ -1657,8 +1660,8 @@
  14.662      ///
  14.663      /// It reads the content of the section.
  14.664      virtual void read(std::istream& is) {
  14.665 -      if (!edgeIdReader->isIdReader()) {
  14.666 -	throw DataFormatError("Cannot find edgeset or ID map");
  14.667 +      if (!edgeLabelReader->isLabelReader()) {
  14.668 +	throw DataFormatError("Cannot find edgeset or label map");
  14.669        }
  14.670        std::string line;
  14.671        while (getline(is, line)) {
  14.672 @@ -1667,7 +1670,7 @@
  14.673  	ls >> id;
  14.674  	typename EdgeReaders::iterator it = readers.find(id);
  14.675  	if (it != readers.end()) {
  14.676 -	  it->second.read(edgeIdReader->read(ls));
  14.677 +	  it->second.read(edgeLabelReader->read(ls));
  14.678  	  it->second.touch();
  14.679  	}	
  14.680        }
  14.681 @@ -1683,18 +1686,18 @@
  14.682      
  14.683    private:
  14.684  
  14.685 -    std::string id;
  14.686 +    std::string name;
  14.687  
  14.688      typedef std::map<std::string, _reader_bits::ItemStore<Edge> > EdgeReaders;
  14.689      EdgeReaders readers;
  14.690 -    std::auto_ptr<_reader_bits::IdReaderBase<Edge> > edgeIdReader;
  14.691 +    std::auto_ptr<_reader_bits::LabelReaderBase<Edge> > edgeLabelReader;
  14.692    };
  14.693  
  14.694    /// \ingroup io_group
  14.695    /// \brief SectionReader for reading labeled undirected edges.
  14.696    ///
  14.697    /// The undirected edges section's header line is \c \@undiredges 
  14.698 -  /// \c undiredges_id, but the \c undiredges_id may be empty.
  14.699 +  /// \c undiredges_name, but the \c undiredges_name may be empty.
  14.700    ///
  14.701    /// Each line in the section contains the name of the undirected edge 
  14.702    /// and then the undirected edge id. 
  14.703 @@ -1713,18 +1716,18 @@
  14.704      /// Constructor for UndirEdgeReader. It creates the UndirEdgeReader and
  14.705      /// attach it into the given LemonReader. It will use the given
  14.706      /// undirected edge id reader to give back the edges. The reader will 
  14.707 -    /// read the section only if the \c _id and the \c undiredges_id are 
  14.708 +    /// read the section only if the \c _name and the \c undiredges_name are 
  14.709      /// the same. 
  14.710 -    template <typename _IdReader>
  14.711 -    UndirEdgeReader(LemonReader& _reader, const _IdReader& _idReader, 
  14.712 -	       const std::string& _id = std::string()) 
  14.713 -      : Parent(_reader), id(_id) {
  14.714 -      checkConcept<_reader_bits::ItemIdReader<UndirEdge>, _IdReader>();
  14.715 -      checkConcept<_reader_bits::ItemIdReader<Edge>, _IdReader>();
  14.716 -      undirEdgeIdReader.reset(new _reader_bits::
  14.717 -			      IdReader<UndirEdge, _IdReader>(_idReader));
  14.718 -      edgeIdReader.reset(new _reader_bits::
  14.719 -			 IdReader<Edge, _IdReader>(_idReader));
  14.720 +    template <typename _LabelReader>
  14.721 +    UndirEdgeReader(LemonReader& _reader, const _LabelReader& _labelReader, 
  14.722 +	       const std::string& _name = std::string()) 
  14.723 +      : Parent(_reader), name(_name) {
  14.724 +      checkConcept<_reader_bits::ItemLabelReader<UndirEdge>, _LabelReader>();
  14.725 +      checkConcept<_reader_bits::ItemLabelReader<Edge>, _LabelReader>();
  14.726 +      undirEdgeLabelReader.reset(new _reader_bits::
  14.727 +			      LabelReader<UndirEdge, _LabelReader>(_labelReader));
  14.728 +      edgeLabelReader.reset(new _reader_bits::
  14.729 +			 LabelReader<Edge, _LabelReader>(_labelReader));
  14.730      }
  14.731  
  14.732      /// \brief Destructor.
  14.733 @@ -1768,11 +1771,11 @@
  14.734      /// the section with the given header line.
  14.735      ///
  14.736      /// It gives back true when the header line start with \c \@edges,
  14.737 -    /// and the header line's id and the reader's id are the same.
  14.738 +    /// and the header line's name and the reader's name are the same.
  14.739      virtual bool header(const std::string& line) {
  14.740        std::istringstream ls(line);
  14.741        std::string command;
  14.742 -      std::string name;
  14.743 +      std::string id;
  14.744        ls >> command >> name;
  14.745        return command == "@undiredges" && name == id;
  14.746      }
  14.747 @@ -1781,11 +1784,11 @@
  14.748      ///
  14.749      /// It reads the content of the section.
  14.750      virtual void read(std::istream& is) {
  14.751 -      if (!edgeIdReader->isIdReader()) {
  14.752 -	throw DataFormatError("Cannot find undirected edgeset or ID map");
  14.753 +      if (!edgeLabelReader->isLabelReader()) {
  14.754 +	throw DataFormatError("Cannot find undirected edgeset or label map");
  14.755        }
  14.756 -      if (!undirEdgeIdReader->isIdReader()) {
  14.757 -	throw DataFormatError("Cannot find undirected edgeset or ID map");
  14.758 +      if (!undirEdgeLabelReader->isLabelReader()) {
  14.759 +	throw DataFormatError("Cannot find undirected edgeset or label map");
  14.760        }
  14.761        std::string line;
  14.762        while (getline(is, line)) {
  14.763 @@ -1795,14 +1798,14 @@
  14.764  	{
  14.765  	  typename UndirEdgeReaders::iterator it = undirEdgeReaders.find(id);
  14.766  	  if (it != undirEdgeReaders.end()) {
  14.767 -	    it->second.read(undirEdgeIdReader->read(ls));
  14.768 +	    it->second.read(undirEdgeLabelReader->read(ls));
  14.769  	    it->second.touch();
  14.770  	    continue;
  14.771  	  }	
  14.772  	} {
  14.773  	  typename EdgeReaders::iterator it = edgeReaders.find(id);
  14.774  	  if (it != edgeReaders.end()) {
  14.775 -	    it->second.read(edgeIdReader->read(ls));
  14.776 +	    it->second.read(edgeLabelReader->read(ls));
  14.777  	    it->second.touch();
  14.778  	    continue;
  14.779  	  }	
  14.780 @@ -1828,24 +1831,24 @@
  14.781      
  14.782    private:
  14.783  
  14.784 -    std::string id;
  14.785 +    std::string name;
  14.786  
  14.787      typedef std::map<std::string, 
  14.788  		     _reader_bits::ItemStore<UndirEdge> > UndirEdgeReaders;
  14.789      UndirEdgeReaders undirEdgeReaders;
  14.790 -    std::auto_ptr<_reader_bits::IdReaderBase<UndirEdge> > undirEdgeIdReader;
  14.791 +    std::auto_ptr<_reader_bits::LabelReaderBase<UndirEdge> > undirEdgeLabelReader;
  14.792  
  14.793      typedef std::map<std::string, _reader_bits::ItemStore<Edge> > EdgeReaders;
  14.794      EdgeReaders edgeReaders;
  14.795 -    std::auto_ptr<_reader_bits::IdReaderBase<Edge> > edgeIdReader;
  14.796 +    std::auto_ptr<_reader_bits::LabelReaderBase<Edge> > edgeLabelReader;
  14.797    };
  14.798  
  14.799    /// \ingroup io_group
  14.800    /// \brief SectionReader for attributes.
  14.801    ///
  14.802    /// The lemon format can store multiple attribute set. Each set has
  14.803 -  /// the header line \c \@attributes \c attributeset_id, but the 
  14.804 -  /// attributeset_id may be empty.
  14.805 +  /// the header line \c \@attributes \c attributeset_name, but the 
  14.806 +  /// attributeset_name may be empty.
  14.807    ///
  14.808    /// The attributeset section contains several lines. Each of them starts
  14.809    /// with an attribute and then a the value for the id.
  14.810 @@ -1860,10 +1863,10 @@
  14.811      ///
  14.812      /// Constructor for AttributeReader. It creates the AttributeReader and
  14.813      /// attach it into the given LemonReader. The reader process a section
  14.814 -    /// only if the \c section_id and the \c _id are the same.
  14.815 +    /// only if the \c section_name and the \c _name are the same.
  14.816      AttributeReader(LemonReader& _reader, 
  14.817 -		    const std::string& _id = std::string()) 
  14.818 -      : Parent(_reader), id(_id) {}
  14.819 +		    const std::string& _name = std::string()) 
  14.820 +      : Parent(_reader), name(_name) {}
  14.821  
  14.822      /// \brief Destructor.
  14.823      ///
  14.824 @@ -1916,7 +1919,7 @@
  14.825      bool header(const std::string& line) {
  14.826        std::istringstream ls(line);
  14.827        std::string command;
  14.828 -      std::string name;
  14.829 +      std::string id;
  14.830        ls >> command >> name;
  14.831        return command == "@attributes" && name == id;
  14.832      }
  14.833 @@ -1933,7 +1936,7 @@
  14.834  	typename Readers::iterator it = readers.find(id);
  14.835  	if (it != readers.end()) {
  14.836  	  it->second->read(ls);
  14.837 -	  it->second->touch();
  14.838 + 	  it->second->touch();
  14.839  	}
  14.840        }
  14.841        for (typename Readers::iterator it = readers.begin();
  14.842 @@ -1947,7 +1950,7 @@
  14.843      }    
  14.844  
  14.845    private:
  14.846 -    std::string id;
  14.847 +    std::string name;
  14.848  
  14.849      typedef std::map<std::string, _reader_bits::ValueReaderBase*> Readers;
  14.850      Readers readers;  
  14.851 @@ -2203,21 +2206,21 @@
  14.852    private:
  14.853  
  14.854      void readMapNames(std::istream& is, std::vector<std::string>& maps) {
  14.855 -      std::string line, id;
  14.856 +      std::string line, name;
  14.857        std::getline(is, line);
  14.858        std::istringstream ls(line);
  14.859 -      while (ls >> id) {
  14.860 -	maps.push_back(id);
  14.861 +      while (ls >> name) {
  14.862 +	maps.push_back(name);
  14.863        }
  14.864        while (getline(is, line));
  14.865      }
  14.866  
  14.867      void readItemNames(std::istream& is, std::vector<std::string>& maps) {
  14.868 -      std::string line, id;
  14.869 +      std::string line, name;
  14.870        while (std::getline(is, line)) {
  14.871  	std::istringstream ls(line);
  14.872 -	ls >> id;
  14.873 -	maps.push_back(id);
  14.874 +	ls >> name;
  14.875 +	maps.push_back(name);
  14.876        }
  14.877      }
  14.878  
    15.1 --- a/lemon/lemon_writer.h	Thu Jan 19 16:56:39 2006 +0000
    15.2 +++ b/lemon/lemon_writer.h	Tue Jan 24 16:07:38 2006 +0000
    15.3 @@ -46,21 +46,21 @@
    15.4    namespace _writer_bits {
    15.5      
    15.6      template <typename Item>
    15.7 -    class ItemIdWriter {
    15.8 +    class ItemLabelWriter {
    15.9      public:
   15.10  
   15.11 -      bool isIdWriter() { return true; }
   15.12 +      bool isLabelWriter() { return true; }
   15.13  
   15.14 -      void writeId(std::ostream&, const Item&) {}
   15.15 +      void writeLabel(std::ostream&, const Item&) {}
   15.16        
   15.17 -      template <class _ItemIdWriter>
   15.18 +      template <class _ItemLabelWriter>
   15.19        struct Constraints {
   15.20  	void constraints() {
   15.21 -	  bool b = writer.isIdWriter();
   15.22 +	  bool b = writer.isLabelWriter();
   15.23  	  ignore_unused_variable_warning(b);
   15.24 -	  writer.writeId(os, item);
   15.25 +	  writer.writeLabel(os, item);
   15.26  	}
   15.27 -	_ItemIdWriter& writer;
   15.28 +	_ItemLabelWriter& writer;
   15.29  	std::ostream& os;
   15.30  	const Item& item;
   15.31        };
   15.32 @@ -225,31 +225,31 @@
   15.33      
   15.34  
   15.35      template <typename _Item>
   15.36 -    class IdWriterBase {
   15.37 +    class LabelWriterBase {
   15.38      public:
   15.39        typedef _Item Item;
   15.40 -      virtual ~IdWriterBase() {}
   15.41 +      virtual ~LabelWriterBase() {}
   15.42        virtual void write(std::ostream&, const Item&) const = 0;
   15.43 -      virtual bool isIdWriter() const = 0;
   15.44 +      virtual bool isLabelWriter() const = 0;
   15.45      };
   15.46  
   15.47 -    template <typename _Item, typename _BoxedIdWriter>
   15.48 -    class IdWriter : public IdWriterBase<_Item> {
   15.49 +    template <typename _Item, typename _BoxedLabelWriter>
   15.50 +    class LabelWriter : public LabelWriterBase<_Item> {
   15.51      public:
   15.52        typedef _Item Item;
   15.53 -      typedef _BoxedIdWriter BoxedIdWriter;
   15.54 +      typedef _BoxedLabelWriter BoxedLabelWriter;
   15.55  
   15.56 -      const BoxedIdWriter& idWriter;
   15.57 +      const BoxedLabelWriter& labelWriter;
   15.58  
   15.59 -      IdWriter(const BoxedIdWriter& _idWriter) 
   15.60 -	: idWriter(_idWriter) {}
   15.61 +      LabelWriter(const BoxedLabelWriter& _labelWriter) 
   15.62 +	: labelWriter(_labelWriter) {}
   15.63  
   15.64        virtual void write(std::ostream& os, const Item& item) const {
   15.65 -	idWriter.writeId(os, item);
   15.66 +	labelWriter.writeLabel(os, item);
   15.67        }
   15.68  
   15.69 -      virtual bool isIdWriter() const {
   15.70 -	return idWriter.isIdWriter();
   15.71 +      virtual bool isLabelWriter() const {
   15.72 +	return labelWriter.isLabelWriter();
   15.73        }
   15.74      };
   15.75  
   15.76 @@ -374,18 +374,18 @@
   15.77    /// \brief SectionWriter for writing a graph's nodeset.
   15.78    ///
   15.79    /// The lemon format can store multiple graph nodesets with several maps.
   15.80 -  /// The nodeset section's header line is \c \@nodeset \c nodeset_id, but the
   15.81 -  /// \c nodeset_id may be empty.
   15.82 +  /// The nodeset section's header line is \c \@nodeset \c nodeset_name, but 
   15.83 +  /// the \c nodeset_name may be empty.
   15.84    ///
   15.85    /// The first line of the section contains the names of the maps separated
   15.86    /// with white spaces. Each next lines describes a node in the nodeset, and
   15.87    /// contains the mapped values for each map.
   15.88    ///
   15.89 -  /// If the nodeset contains an \c "id" named map then it will be regarded
   15.90 -  /// as id map. This map should contain only unique values and when the 
   15.91 -  /// \c writeId() member will be called with a node it will write it's id.
   15.92 -  /// Otherwise if the \c _forceIdMap constructor parameter is true then
   15.93 -  /// the id map will be the id in the graph.
   15.94 +  /// If the nodeset contains an \c "label" named map then it will be regarded
   15.95 +  /// as label map. This map should contain only unique values and when the 
   15.96 +  /// \c writeLabel() member will be called with a node it will write it's 
   15.97 +  /// label. Otherwise if the \c _forceLabelMap constructor parameter is true 
   15.98 +  /// then the label map will be the id in the graph.
   15.99    ///
  15.100    /// \relates LemonWriter
  15.101    template <typename _Graph, typename _Traits = DefaultWriterTraits>
  15.102 @@ -400,14 +400,14 @@
  15.103      /// \brief Constructor.
  15.104      ///
  15.105      /// Constructor for NodeSetWriter. It creates the NodeSetWriter and
  15.106 -    /// attach it into the given LemonWriter. If the \c _forceIdMap
  15.107 -    /// parameter is true then the writer will write own id map when
  15.108 -    /// the user does not give "id" named map.
  15.109 +    /// attach it into the given LemonWriter. If the \c _forceLabelMap
  15.110 +    /// parameter is true then the writer will write own label map when
  15.111 +    /// the user does not give "label" named map.
  15.112      NodeSetWriter(LemonWriter& _writer, const Graph& _graph, 
  15.113 -		  const std::string& _id = std::string(), 
  15.114 -		  bool _forceIdMap = true) 
  15.115 -      : Parent(_writer), idMap(0), forceIdMap(_forceIdMap), 
  15.116 -	graph(_graph), id(_id) {}
  15.117 +		  const std::string& _name = std::string(), 
  15.118 +		  bool _forceLabelMap = true) 
  15.119 +      : Parent(_writer), labelMap(0), forceLabelMap(_forceLabelMap), 
  15.120 +	graph(_graph), name(_name) {}
  15.121  
  15.122      /// \brief Destructor.
  15.123      ///
  15.124 @@ -454,7 +454,7 @@
  15.125      ///
  15.126      /// It gives back the header of the section.
  15.127      virtual std::string header() {
  15.128 -      return "@nodeset " + id;
  15.129 +      return "@nodeset " + name;
  15.130      }
  15.131  
  15.132      /// \brief  Writer function of the section.
  15.133 @@ -462,21 +462,21 @@
  15.134      /// Write the content of the section.
  15.135      virtual void write(std::ostream& os) {
  15.136        for (int i = 0; i < (int)writers.size(); ++i) {
  15.137 -	if (writers[i].first == "id") {
  15.138 -	  idMap = writers[i].second;
  15.139 -	  forceIdMap = false;
  15.140 +	if (writers[i].first == "label" || (writers[i].first == "id" && labelMap == 0)) {
  15.141 +	  labelMap = writers[i].second;
  15.142 +	  forceLabelMap = false;
  15.143  	  break;
  15.144  	}
  15.145        }
  15.146 -      if (forceIdMap) {
  15.147 -	os << "id\t";
  15.148 +      if (forceLabelMap) {
  15.149 +	os << "label\t";
  15.150        }
  15.151        for (int i = 0; i < (int)writers.size(); ++i) {
  15.152  	os << writers[i].first << '\t';
  15.153        }
  15.154        os << std::endl;
  15.155        for (typename Graph::NodeIt it(graph); it != INVALID; ++it) {
  15.156 -	if (forceIdMap) {
  15.157 +	if (forceLabelMap) {
  15.158  	  os << graph.id(it) << '\t';
  15.159  	}
  15.160  	for (int i = 0; i < (int)writers.size(); ++i) {
  15.161 @@ -489,26 +489,26 @@
  15.162  
  15.163    public:
  15.164  
  15.165 -    /// \brief Returns true if the nodeset can write the ids of the nodes.
  15.166 +    /// \brief Returns true if the nodeset can write the labels of the nodes.
  15.167      ///
  15.168 -    /// Returns true if the nodeset can write the ids of the nodes.
  15.169 -    /// It is possible only if an "id" named map was written or the 
  15.170 -    /// \c _forceIdMap constructor parameter was true.
  15.171 -    bool isIdWriter() const {
  15.172 -      return idMap != 0 || forceIdMap;
  15.173 +    /// Returns true if the nodeset can write the labels of the nodes.
  15.174 +    /// It is possible only if an "label" named map was written or the 
  15.175 +    /// \c _forceLabelMap constructor parameter was true.
  15.176 +    bool isLabelWriter() const {
  15.177 +      return labelMap != 0 || forceLabelMap;
  15.178      }
  15.179  
  15.180 -    /// \brief Write the id of the given node.
  15.181 +    /// \brief Write the label of the given node.
  15.182      ///
  15.183 -    /// It writes the id of the given node. If there was written an "id"
  15.184 +    /// It writes the label of the given node. If there was written an "label"
  15.185      /// named map then it will write the map value belongs to the node.
  15.186 -    /// Otherwise if the \c forceId parameter was true it will write
  15.187 -    /// its id in the graph. 
  15.188 -    void writeId(std::ostream& os, const Node& item) const {
  15.189 -      if (forceIdMap) {
  15.190 +    /// Otherwise if the \c forceLabel parameter was true it will write
  15.191 +    /// its label in the graph. 
  15.192 +    void writeLabel(std::ostream& os, const Node& item) const {
  15.193 +      if (forceLabelMap) {
  15.194  	os << graph.id(item);
  15.195        } else {
  15.196 -	idMap->write(os, item);
  15.197 +	labelMap->write(os, item);
  15.198        }
  15.199      }
  15.200  
  15.201 @@ -518,11 +518,11 @@
  15.202  				  MapWriterBase<Node>*> > MapWriters;
  15.203      MapWriters writers;
  15.204  
  15.205 -    _writer_bits::MapWriterBase<Node>* idMap;
  15.206 -    bool forceIdMap;
  15.207 +    _writer_bits::MapWriterBase<Node>* labelMap;
  15.208 +    bool forceLabelMap;
  15.209     
  15.210      const Graph& graph;   
  15.211 -    std::string id;
  15.212 +    std::string name;
  15.213  
  15.214    };
  15.215  
  15.216 @@ -530,22 +530,22 @@
  15.217    /// \brief SectionWriter for writing a graph's edgesets.
  15.218    ///
  15.219    /// The lemon format can store multiple graph edgesets with several maps. 
  15.220 -  /// The edgeset section's header line is \c \@edgeset \c edgeset_id, but the
  15.221 -  /// \c edgeset_id may be empty.
  15.222 +  /// The edgeset section's header line is \c \@edgeset \c edgeset_name, but 
  15.223 +  /// the \c edgeset_name may be empty.
  15.224    ///
  15.225    /// The first line of the section contains the names of the maps separated
  15.226    /// with white spaces. Each next lines describes a edge in the edgeset. The
  15.227 -  /// line contains the source and the target nodes' id and the mapped 
  15.228 +  /// line contains the source and the target nodes' label and the mapped 
  15.229    /// values for each map.
  15.230    ///
  15.231 -  /// If the edgeset contains an \c "id" named map then it will be regarded
  15.232 -  /// as id map. This map should contain only unique values and when the 
  15.233 -  /// \c writeId() member will be called with an edge it will write it's id.
  15.234 -  /// Otherwise if the \c _forceIdMap constructor parameter is true then
  15.235 -  /// the id map will be the id in the graph.
  15.236 +  /// If the edgeset contains an \c "label" named map then it will be regarded
  15.237 +  /// as label map. This map should contain only unique values and when the 
  15.238 +  /// \c writeLabel() member will be called with an edge it will write it's 
  15.239 +  /// label. Otherwise if the \c _forceLabelMap constructor parameter is true 
  15.240 +  /// then the label map will be the id in the graph.
  15.241    ///
  15.242 -  /// The edgeset writer needs a node id writer to identify which nodes
  15.243 -  /// have to be connected. If a NodeSetWriter can write the nodes' id,
  15.244 +  /// The edgeset writer needs a node label writer to identify which nodes
  15.245 +  /// have to be connected. If a NodeSetWriter can write the nodes' label,
  15.246    /// it will be able to use with this class.
  15.247    ///
  15.248    /// \relates LemonWriter
  15.249 @@ -562,20 +562,20 @@
  15.250      /// \brief Constructor.
  15.251      ///
  15.252      /// Constructor for EdgeSetWriter. It creates the EdgeSetWriter and
  15.253 -    /// attach it into the given LemonWriter. It will write node ids by
  15.254 -    /// the \c _nodeIdWriter. If the \c _forceIdMap parameter is true 
  15.255 -    /// then the writer will write own id map if the user does not give 
  15.256 -    /// "id" named map.
  15.257 -    template <typename NodeIdWriter>
  15.258 +    /// attach it into the given LemonWriter. It will write node labels by
  15.259 +    /// the \c _nodeLabelWriter. If the \c _forceLabelMap parameter is true 
  15.260 +    /// then the writer will write own label map if the user does not give 
  15.261 +    /// "label" named map.
  15.262 +    template <typename NodeLabelWriter>
  15.263      EdgeSetWriter(LemonWriter& _writer, const Graph& _graph, 
  15.264 -		  const NodeIdWriter& _nodeIdWriter, 
  15.265 -		  const std::string& _id = std::string(),
  15.266 -		  bool _forceIdMap = true)
  15.267 -      : Parent(_writer), idMap(0), forceIdMap(_forceIdMap),
  15.268 -	graph(_graph), id(_id) {
  15.269 -      checkConcept<_writer_bits::ItemIdWriter<Node>, NodeIdWriter>();
  15.270 -      nodeIdWriter.reset(new _writer_bits::
  15.271 -			 IdWriter<Node, NodeIdWriter>(_nodeIdWriter));
  15.272 +		  const NodeLabelWriter& _nodeLabelWriter, 
  15.273 +		  const std::string& _name = std::string(),
  15.274 +		  bool _forceLabelMap = true)
  15.275 +      : Parent(_writer), labelMap(0), forceLabelMap(_forceLabelMap),
  15.276 +	graph(_graph), name(_name) {
  15.277 +      checkConcept<_writer_bits::ItemLabelWriter<Node>, NodeLabelWriter>();
  15.278 +      nodeLabelWriter.reset(new _writer_bits::
  15.279 +			 LabelWriter<Node, NodeLabelWriter>(_nodeLabelWriter));
  15.280      } 
  15.281  
  15.282      /// \brief Destructor.
  15.283 @@ -623,37 +623,37 @@
  15.284      ///
  15.285      /// It gives back the header of the section.
  15.286      virtual std::string header() {
  15.287 -      return "@edgeset " + id;
  15.288 +      return "@edgeset " + name;
  15.289      }
  15.290  
  15.291      /// \brief  Writer function of the section.
  15.292      ///
  15.293      /// Write the content of the section.
  15.294      virtual void write(std::ostream& os) {
  15.295 -      if (!nodeIdWriter->isIdWriter()) {
  15.296 -	throw DataFormatError("Cannot find nodeset or ID map");
  15.297 +      if (!nodeLabelWriter->isLabelWriter()) {
  15.298 +	throw DataFormatError("Cannot find nodeset or label map");
  15.299        }
  15.300        for (int i = 0; i < (int)writers.size(); ++i) {
  15.301 -	if (writers[i].first == "id") {
  15.302 -	  idMap = writers[i].second;
  15.303 -	  forceIdMap = false;
  15.304 +	if (writers[i].first == "label" || (writers[i].first == "id" && labelMap == 0)) {
  15.305 +	  labelMap = writers[i].second;
  15.306 +	  forceLabelMap = false;
  15.307  	  break;
  15.308  	}
  15.309        }
  15.310        os << "\t\t";
  15.311 -      if (forceIdMap) {
  15.312 -	os << "id\t";
  15.313 +      if (forceLabelMap) {
  15.314 +	os << "label\t";
  15.315        }
  15.316        for (int i = 0; i < (int)writers.size(); ++i) {
  15.317  	os << writers[i].first << '\t';
  15.318        }
  15.319        os << std::endl;
  15.320        for (typename Graph::EdgeIt it(graph); it != INVALID; ++it) {
  15.321 -	nodeIdWriter->write(os, graph.source(it));
  15.322 +	nodeLabelWriter->write(os, graph.source(it));
  15.323  	os << '\t';
  15.324 -	nodeIdWriter->write(os, graph.target(it));
  15.325 +	nodeLabelWriter->write(os, graph.target(it));
  15.326  	os << '\t';
  15.327 -	if (forceIdMap) {
  15.328 +	if (forceLabelMap) {
  15.329  	  os << graph.id(it) << '\t';
  15.330  	}
  15.331  	for (int i = 0; i < (int)writers.size(); ++i) {
  15.332 @@ -666,26 +666,26 @@
  15.333  
  15.334    public:
  15.335  
  15.336 -    /// \brief Returns true if the edgeset can write the ids of the edges.
  15.337 +    /// \brief Returns true if the edgeset can write the labels of the edges.
  15.338      ///
  15.339 -    /// Returns true if the edgeset can write the ids of the edges.
  15.340 -    /// It is possible only if an "id" named map was written or the 
  15.341 -    /// \c _forceIdMap constructor parameter was true.
  15.342 -    bool isIdWriter() const {
  15.343 -      return forceIdMap || idMap != 0;
  15.344 +    /// Returns true if the edgeset can write the labels of the edges.
  15.345 +    /// It is possible only if an "label" named map was written or the 
  15.346 +    /// \c _forceLabelMap constructor parameter was true.
  15.347 +    bool isLabelWriter() const {
  15.348 +      return forceLabelMap || labelMap != 0;
  15.349      }
  15.350  
  15.351 -    /// \brief Write the id of the given edge.
  15.352 +    /// \brief Write the label of the given edge.
  15.353      ///
  15.354 -    /// It writes the id of the given edge. If there was written an "id"
  15.355 +    /// It writes the label of the given edge. If there was written an "label"
  15.356      /// named map then it will write the map value belongs to the edge.
  15.357 -    /// Otherwise if the \c forceId parameter was true it will write
  15.358 -    /// its id in the graph. 
  15.359 -    void writeId(std::ostream& os, const Edge& item) const {
  15.360 -      if (forceIdMap) {
  15.361 +    /// Otherwise if the \c forceLabel parameter was true it will write
  15.362 +    /// its label in the graph. 
  15.363 +    void writeLabel(std::ostream& os, const Edge& item) const {
  15.364 +      if (forceLabelMap) {
  15.365  	os << graph.id(item);
  15.366        } else {
  15.367 -	idMap->write(os, item);
  15.368 +	labelMap->write(os, item);
  15.369        }
  15.370      } 
  15.371  
  15.372 @@ -695,13 +695,13 @@
  15.373  				  MapWriterBase<Edge>*> > MapWriters;
  15.374      MapWriters writers;
  15.375  
  15.376 -    _writer_bits::MapWriterBase<Edge>* idMap;
  15.377 -    bool forceIdMap;
  15.378 +    _writer_bits::MapWriterBase<Edge>* labelMap;
  15.379 +    bool forceLabelMap;
  15.380     
  15.381      const Graph& graph;   
  15.382 -    std::string id;
  15.383 +    std::string name;
  15.384  
  15.385 -    std::auto_ptr<_writer_bits::IdWriterBase<Node> > nodeIdWriter;
  15.386 +    std::auto_ptr<_writer_bits::LabelWriterBase<Node> > nodeLabelWriter;
  15.387    };
  15.388  
  15.389    /// \ingroup io_group
  15.390 @@ -709,11 +709,11 @@
  15.391    ///
  15.392    /// The lemon format can store multiple undirected edgesets with several 
  15.393    /// maps. The undirected edgeset section's header line is \c \@undiredgeset 
  15.394 -  /// \c undiredgeset_id, but the \c undiredgeset_id may be empty.
  15.395 +  /// \c undiredgeset_name, but the \c undiredgeset_name may be empty.
  15.396    ///
  15.397    /// The first line of the section contains the names of the maps separated
  15.398    /// with white spaces. Each next lines describes an undirected edge in the 
  15.399 -  /// edgeset. The line contains the two connected nodes' id and the mapped 
  15.400 +  /// edgeset. The line contains the two connected nodes' label and the mapped 
  15.401    /// values for each undirected map.
  15.402    ///
  15.403    /// The section can handle the directed as a syntactical sugar. Two
  15.404 @@ -722,15 +722,15 @@
  15.405    /// is near the same just with a prefix \c '+' or \c '-' character 
  15.406    /// difference.
  15.407    ///
  15.408 -  /// If the edgeset contains an \c "id" named map then it will be regarded
  15.409 -  /// as id map. This map should contain only unique values and when the 
  15.410 -  /// \c writeId() member will be called with an undirected edge it will 
  15.411 -  /// write it's id. Otherwise if the \c _forceIdMap constructor parameter
  15.412 -  /// is true then the id map will be the id in the graph.
  15.413 +  /// If the edgeset contains an \c "label" named map then it will be regarded
  15.414 +  /// as label map. This map should contain only unique values and when the 
  15.415 +  /// \c writeLabel() member will be called with an undirected edge it will 
  15.416 +  /// write it's label. Otherwise if the \c _forceLabelMap constructor 
  15.417 +  /// parameter is true then the label map will be the id in the graph.
  15.418    ///
  15.419 -  /// The undirected edgeset writer needs a node id writer to identify 
  15.420 +  /// The undirected edgeset writer needs a node label writer to identify 
  15.421    /// which nodes have to be connected. If a NodeSetWriter can write the 
  15.422 -  /// nodes' id, it will be able to use with this class.
  15.423 +  /// nodes' label, it will be able to use with this class.
  15.424    ///
  15.425    /// \relates LemonWriter
  15.426    template <typename _Graph, typename _Traits = DefaultWriterTraits>
  15.427 @@ -747,20 +747,20 @@
  15.428      /// \brief Constructor.
  15.429      ///
  15.430      /// Constructor for UndirEdgeSetWriter. It creates the UndirEdgeSetWriter
  15.431 -    /// and attach it into the given LemonWriter. It will write node ids by
  15.432 -    /// the \c _nodeIdWriter. If the \c _forceIdMap parameter is true 
  15.433 -    /// then the writer will write own id map if the user does not give 
  15.434 -    /// "id" named map.
  15.435 -    template <typename NodeIdWriter>
  15.436 +    /// and attach it into the given LemonWriter. It will write node labels by
  15.437 +    /// the \c _nodeLabelWriter. If the \c _forceLabelMap parameter is true 
  15.438 +    /// then the writer will write own label map if the user does not give 
  15.439 +    /// "label" named map.
  15.440 +    template <typename NodeLabelWriter>
  15.441      UndirEdgeSetWriter(LemonWriter& _writer, const Graph& _graph, 
  15.442 -		       const NodeIdWriter& _nodeIdWriter, 
  15.443 -		       const std::string& _id = std::string(),
  15.444 -		       bool _forceIdMap = true)
  15.445 -      : Parent(_writer), idMap(0), forceIdMap(_forceIdMap),
  15.446 -	graph(_graph), id(_id) {
  15.447 -      checkConcept<_writer_bits::ItemIdWriter<Node>, NodeIdWriter>();
  15.448 -      nodeIdWriter.reset(new _writer_bits::
  15.449 -			 IdWriter<Node, NodeIdWriter>(_nodeIdWriter));
  15.450 +		       const NodeLabelWriter& _nodeLabelWriter, 
  15.451 +		       const std::string& _name = std::string(),
  15.452 +		       bool _forceLabelMap = true)
  15.453 +      : Parent(_writer), labelMap(0), forceLabelMap(_forceLabelMap),
  15.454 +	graph(_graph), name(_name) {
  15.455 +      checkConcept<_writer_bits::ItemLabelWriter<Node>, NodeLabelWriter>();
  15.456 +      nodeLabelWriter.reset(new _writer_bits::
  15.457 +			 LabelWriter<Node, NodeLabelWriter>(_nodeLabelWriter));
  15.458      } 
  15.459  
  15.460      /// \brief Destructor.
  15.461 @@ -832,37 +832,37 @@
  15.462      ///
  15.463      /// It gives back the header of the section.
  15.464      virtual std::string header() {
  15.465 -      return "@undiredgeset " + id;
  15.466 +      return "@undiredgeset " + name;
  15.467      }
  15.468  
  15.469      /// \brief  Writer function of the section.
  15.470      ///
  15.471      /// Write the content of the section.
  15.472      virtual void write(std::ostream& os) {
  15.473 -      if (!nodeIdWriter->isIdWriter()) {
  15.474 -	throw DataFormatError("Cannot find nodeset or ID map");
  15.475 +      if (!nodeLabelWriter->isLabelWriter()) {
  15.476 +	throw DataFormatError("Cannot find nodeset or label map");
  15.477        }
  15.478        for (int i = 0; i < (int)writers.size(); ++i) {
  15.479 -	if (writers[i].first == "id") {
  15.480 -	  idMap = writers[i].second;
  15.481 -	  forceIdMap = false;
  15.482 +	if (writers[i].first == "label") {
  15.483 +	  labelMap = writers[i].second;
  15.484 +	  forceLabelMap = false;
  15.485  	  break;
  15.486  	}
  15.487        }
  15.488        os << "\t\t";
  15.489 -      if (forceIdMap) {
  15.490 -	os << "id\t";
  15.491 +      if (forceLabelMap) {
  15.492 +	os << "label\t";
  15.493        }
  15.494        for (int i = 0; i < (int)writers.size(); ++i) {
  15.495  	os << writers[i].first << '\t';
  15.496        }
  15.497        os << std::endl;
  15.498        for (typename Graph::UndirEdgeIt it(graph); it != INVALID; ++it) {
  15.499 -	nodeIdWriter->write(os, graph.source(it));
  15.500 +	nodeLabelWriter->write(os, graph.source(it));
  15.501  	os << '\t';
  15.502 -	nodeIdWriter->write(os, graph.target(it));
  15.503 +	nodeLabelWriter->write(os, graph.target(it));
  15.504  	os << '\t';
  15.505 -	if (forceIdMap) {
  15.506 +	if (forceLabelMap) {
  15.507  	  os << graph.id(it) << '\t';
  15.508  	}
  15.509  	for (int i = 0; i < (int)writers.size(); ++i) {
  15.510 @@ -875,47 +875,47 @@
  15.511  
  15.512    public:
  15.513  
  15.514 -    /// \brief Returns true if the undirected edgeset can write the ids of 
  15.515 +    /// \brief Returns true if the undirected edgeset can write the labels of 
  15.516      /// the edges.
  15.517      ///
  15.518 -    /// Returns true if the undirected edgeset can write the ids of the 
  15.519 -    /// undirected edges. It is possible only if an "id" named map was 
  15.520 -    /// written or the \c _forceIdMap constructor parameter was true.
  15.521 -    bool isIdWriter() const {
  15.522 -      return forceIdMap || idMap != 0;
  15.523 +    /// Returns true if the undirected edgeset can write the labels of the 
  15.524 +    /// undirected edges. It is possible only if an "label" named map was 
  15.525 +    /// written or the \c _forceLabelMap constructor parameter was true.
  15.526 +    bool isLabelWriter() const {
  15.527 +      return forceLabelMap || labelMap != 0;
  15.528      }
  15.529  
  15.530 -    /// \brief Write the id of the given undirected edge.
  15.531 +    /// \brief Write the label of the given undirected edge.
  15.532      ///
  15.533 -    /// It writes the id of the given undirected edge. If there was written 
  15.534 -    /// an "id" named map then it will write the map value belongs to the 
  15.535 -    /// undirected edge. Otherwise if the \c forceId parameter was true it 
  15.536 +    /// It writes the label of the given undirected edge. If there was written 
  15.537 +    /// an "label" named map then it will write the map value belongs to the 
  15.538 +    /// undirected edge. Otherwise if the \c forceLabel parameter was true it 
  15.539      /// will write its id in the graph. 
  15.540 -    void writeId(std::ostream& os, const UndirEdge& item) const {
  15.541 -      if (forceIdMap) {
  15.542 +    void writeLabel(std::ostream& os, const UndirEdge& item) const {
  15.543 +      if (forceLabelMap) {
  15.544  	os << graph.id(item);
  15.545        } else {
  15.546 -	idMap->write(os, item);
  15.547 +	labelMap->write(os, item);
  15.548        }
  15.549      } 
  15.550  
  15.551 -    /// \brief Write the id of the given edge.
  15.552 +    /// \brief Write the label of the given edge.
  15.553      ///
  15.554 -    /// It writes the id of the given edge. If there was written 
  15.555 -    /// an "id" named map then it will write the map value belongs to the 
  15.556 -    /// edge. Otherwise if the \c forceId parameter was true it 
  15.557 +    /// It writes the label of the given edge. If there was written 
  15.558 +    /// an "label" named map then it will write the map value belongs to the 
  15.559 +    /// edge. Otherwise if the \c forceLabel parameter was true it 
  15.560      /// will write its id in the graph. If the edge is forward map
  15.561      /// then its prefix character is \c '+' elsewhere \c '-'.
  15.562 -    void writeId(std::ostream& os, const Edge& item) const {
  15.563 +    void writeLabel(std::ostream& os, const Edge& item) const {
  15.564        if (graph.direction(item)) {
  15.565  	os << "+ ";
  15.566        } else {
  15.567  	os << "- ";
  15.568        }
  15.569 -      if (forceIdMap) {
  15.570 +      if (forceLabelMap) {
  15.571  	os << graph.id(item);
  15.572        } else {
  15.573 -	idMap->write(os, item);
  15.574 +	labelMap->write(os, item);
  15.575        }
  15.576      } 
  15.577  
  15.578 @@ -925,23 +925,23 @@
  15.579  				  MapWriterBase<UndirEdge>*> > MapWriters;
  15.580      MapWriters writers;
  15.581  
  15.582 -    _writer_bits::MapWriterBase<UndirEdge>* idMap;
  15.583 -    bool forceIdMap;
  15.584 +    _writer_bits::MapWriterBase<UndirEdge>* labelMap;
  15.585 +    bool forceLabelMap;
  15.586     
  15.587      const Graph& graph;   
  15.588 -    std::string id;
  15.589 +    std::string name;
  15.590  
  15.591 -    std::auto_ptr<_writer_bits::IdWriterBase<Node> > nodeIdWriter;
  15.592 +    std::auto_ptr<_writer_bits::LabelWriterBase<Node> > nodeLabelWriter;
  15.593    };
  15.594  
  15.595    /// \ingroup io_group
  15.596 -  /// \brief SectionWriter for writing labeled nodes.
  15.597 +  /// \brief SectionWriter for writing named nodes.
  15.598    ///
  15.599 -  /// The nodes section's header line is \c \@nodes \c nodes_id, but the
  15.600 -  /// \c nodes_id may be empty.
  15.601 +  /// The nodes section's header line is \c \@nodes \c nodes_name, but the
  15.602 +  /// \c nodes_name may be empty.
  15.603    ///
  15.604 -  /// Each line in the section contains the label of the node and 
  15.605 -  /// then the node id. 
  15.606 +  /// Each line in the section contains the name of the node and 
  15.607 +  /// then the node label. 
  15.608    ///
  15.609    /// \relates LemonWriter
  15.610    template <typename _Graph>
  15.611 @@ -954,14 +954,15 @@
  15.612      /// \brief Constructor.
  15.613      ///
  15.614      /// Constructor for NodeWriter. It creates the NodeWriter and
  15.615 -    /// attach it into the given LemonWriter. The given \c _IdWriter
  15.616 -    /// will write the nodes' id what can be a nodeset writer.
  15.617 -    template <typename _IdWriter>
  15.618 -    NodeWriter(LemonWriter& _writer, const _IdWriter& _idWriter, 
  15.619 -	       const std::string& _id = std::string()) 
  15.620 -      : Parent(_writer), id(_id) {
  15.621 -      checkConcept<_writer_bits::ItemIdWriter<Node>, _IdWriter>();
  15.622 -      idWriter.reset(new _writer_bits::IdWriter<Node, _IdWriter>(_idWriter));
  15.623 +    /// attach it into the given LemonWriter. The given \c _LabelWriter
  15.624 +    /// will write the nodes' label what can be a nodeset writer.
  15.625 +    template <typename _LabelWriter>
  15.626 +    NodeWriter(LemonWriter& _writer, const _LabelWriter& _labelWriter, 
  15.627 +	       const std::string& _name = std::string()) 
  15.628 +      : Parent(_writer), name(_name) {
  15.629 +      checkConcept<_writer_bits::ItemLabelWriter<Node>, _LabelWriter>();
  15.630 +      labelWriter.reset(new _writer_bits::LabelWriter<Node, _LabelWriter>
  15.631 +                        (_labelWriter));
  15.632      }
  15.633  
  15.634  
  15.635 @@ -985,45 +986,44 @@
  15.636  
  15.637    protected:
  15.638  
  15.639 -    /// \brief Header checking function.
  15.640 +    /// \brief The header of the section.
  15.641      ///
  15.642 -    /// It gives back true when the header line start with \c \@nodes,
  15.643 -    /// and the header line's id and the writer's id are the same.
  15.644 +    /// It gives back the header of the section.
  15.645      virtual std::string header() {
  15.646 -      return "@nodes " + id;
  15.647 +      return "@nodes " + name;
  15.648      }
  15.649  
  15.650      /// \brief  Writer function of the section.
  15.651      ///
  15.652      /// Write the content of the section.
  15.653      virtual void write(std::ostream& os) {
  15.654 -      if (!idWriter->isIdWriter()) {
  15.655 -	throw DataFormatError("Cannot find nodeset or ID map");
  15.656 +      if (!labelWriter->isLabelWriter()) {
  15.657 +	throw DataFormatError("Cannot find nodeset or label map");
  15.658        }
  15.659        for (int i = 0; i < (int)writers.size(); ++i) {
  15.660  	os << writers[i].first << ' ';
  15.661 -	idWriter->write(os, *(writers[i].second));
  15.662 +	labelWriter->write(os, *(writers[i].second));
  15.663  	os << std::endl;
  15.664        }
  15.665      }
  15.666      
  15.667    private:
  15.668  
  15.669 -    std::string id;
  15.670 +    std::string name;
  15.671  
  15.672      typedef std::vector<std::pair<std::string, const Node*> > NodeWriters;
  15.673      NodeWriters writers;
  15.674 -    std::auto_ptr<_writer_bits::IdWriterBase<Node> > idWriter;
  15.675 +    std::auto_ptr<_writer_bits::LabelWriterBase<Node> > labelWriter;
  15.676    };
  15.677  
  15.678    /// \ingroup io_group
  15.679 -  /// \brief SectionWriter for writing labeled edges.
  15.680 +  /// \brief SectionWriter for writing named edges.
  15.681    ///
  15.682 -  /// The edges section's header line is \c \@edges \c edges_id, but the
  15.683 -  /// \c edges_id may be empty.
  15.684 +  /// The edges section's header line is \c \@edges \c edges_name, but the
  15.685 +  /// \c edges_name may be empty.
  15.686    ///
  15.687 -  /// Each line in the section contains the label of the edge and 
  15.688 -  /// then the edge id. 
  15.689 +  /// Each line in the section contains the name of the edge and 
  15.690 +  /// then the edge label. 
  15.691    ///
  15.692    /// \relates LemonWriter
  15.693    template <typename _Graph>
  15.694 @@ -1036,14 +1036,14 @@
  15.695      /// \brief Constructor.
  15.696      ///
  15.697      /// Constructor for EdgeWriter. It creates the EdgeWriter and
  15.698 -    /// attach it into the given LemonWriter. The given \c _IdWriter
  15.699 -    /// will write the edges' id what can be a edgeset writer.
  15.700 -    template <typename _IdWriter>
  15.701 -    EdgeWriter(LemonWriter& _writer, const _IdWriter& _idWriter, 
  15.702 -	       const std::string& _id = std::string()) 
  15.703 -      : Parent(_writer), id(_id) {
  15.704 -      checkConcept<_writer_bits::ItemIdWriter<Edge>, _IdWriter>();
  15.705 -      idWriter.reset(new _writer_bits::IdWriter<Edge, _IdWriter>(_idWriter));
  15.706 +    /// attach it into the given LemonWriter. The given \c _LabelWriter
  15.707 +    /// will write the edges' label what can be a edgeset writer.
  15.708 +    template <typename _LabelWriter>
  15.709 +    EdgeWriter(LemonWriter& _writer, const _LabelWriter& _labelWriter, 
  15.710 +	       const std::string& _name = std::string()) 
  15.711 +      : Parent(_writer), name(_name) {
  15.712 +      checkConcept<_writer_bits::ItemLabelWriter<Edge>, _LabelWriter>();
  15.713 +      labelWriter.reset(new _writer_bits::LabelWriter<Edge, _LabelWriter>(_labelWriter));
  15.714      }
  15.715  
  15.716      /// \brief Destructor.
  15.717 @@ -1065,46 +1065,45 @@
  15.718  
  15.719    protected:
  15.720  
  15.721 -    /// \brief Header checking function.
  15.722 +    /// \brief The header of the section.
  15.723      ///
  15.724 -    /// It gives back true when the header line start with \c \@edges,
  15.725 -    /// and the header line's id and the writer's id are the same.
  15.726 +    /// It gives back the header of the section.
  15.727      virtual std::string header() {
  15.728 -      return "@edges " + id;
  15.729 +      return "@edges " + name;
  15.730      }
  15.731  
  15.732      /// \brief  Writer function of the section.
  15.733      ///
  15.734      /// Write the content of the section.
  15.735      virtual void write(std::ostream& os) {
  15.736 -      if (!idWriter->isIdWriter()) {
  15.737 -	throw DataFormatError("Cannot find edgeset or ID map");
  15.738 +      if (!labelWriter->isLabelWriter()) {
  15.739 +	throw DataFormatError("Cannot find edgeset or label map");
  15.740        }
  15.741        for (int i = 0; i < (int)writers.size(); ++i) {
  15.742  	os << writers[i].first << ' ';
  15.743 -	idWriter->write(os, *(writers[i].second));
  15.744 +	labelWriter->write(os, *(writers[i].second));
  15.745  	os << std::endl;
  15.746        }
  15.747      }
  15.748      
  15.749    private:
  15.750  
  15.751 -    std::string id;
  15.752 +    std::string name;
  15.753  
  15.754      typedef std::vector<std::pair<std::string, const Edge*> > EdgeWriters;
  15.755      EdgeWriters writers;
  15.756  
  15.757 -    std::auto_ptr<_writer_bits::IdWriterBase<Edge> > idWriter;
  15.758 +    std::auto_ptr<_writer_bits::LabelWriterBase<Edge> > labelWriter;
  15.759    };
  15.760  
  15.761    /// \ingroup io_group
  15.762 -  /// \brief SectionWriter for writing labeled undirected edges.
  15.763 +  /// \brief SectionWriter for writing named undirected edges.
  15.764    ///
  15.765    /// The undirected edges section's header line is \c \@undiredges 
  15.766 -  /// \c undiredges_id, but the \c undiredges_id may be empty.
  15.767 +  /// \c undiredges_name, but the \c undiredges_name may be empty.
  15.768    ///
  15.769 -  /// Each line in the section contains the label of the undirected edge and 
  15.770 -  /// then the undirected edge id. 
  15.771 +  /// Each line in the section contains the name of the undirected edge and 
  15.772 +  /// then the undirected edge label. 
  15.773    ///
  15.774    /// \relates LemonWriter
  15.775    template <typename _Graph>
  15.776 @@ -1119,19 +1118,19 @@
  15.777      /// \brief Constructor.
  15.778      ///
  15.779      /// Constructor for UndirEdgeWriter. It creates the UndirEdgeWriter and
  15.780 -    /// attach it into the given LemonWriter. The given \c _IdWriter
  15.781 -    /// will write the undirected edges' id what can be an undirected 
  15.782 +    /// attach it into the given LemonWriter. The given \c _LabelWriter
  15.783 +    /// will write the undirected edges' label what can be an undirected 
  15.784      /// edgeset writer.
  15.785 -    template <typename _IdWriter>
  15.786 -    UndirEdgeWriter(LemonWriter& _writer, const _IdWriter& _idWriter, 
  15.787 -	       const std::string& _id = std::string()) 
  15.788 -      : Parent(_writer), id(_id) {
  15.789 -      checkConcept<_writer_bits::ItemIdWriter<Edge>, _IdWriter>();
  15.790 -      checkConcept<_writer_bits::ItemIdWriter<UndirEdge>, _IdWriter>();
  15.791 -      undirEdgeIdWriter.reset(new _writer_bits::
  15.792 -			      IdWriter<UndirEdge, _IdWriter>(_idWriter));
  15.793 -      edgeIdWriter.reset(new _writer_bits::
  15.794 -			 IdWriter<Edge, _IdWriter>(_idWriter));
  15.795 +    template <typename _LabelWriter>
  15.796 +    UndirEdgeWriter(LemonWriter& _writer, const _LabelWriter& _labelWriter, 
  15.797 +	       const std::string& _name = std::string()) 
  15.798 +      : Parent(_writer), name(_name) {
  15.799 +      checkConcept<_writer_bits::ItemLabelWriter<Edge>, _LabelWriter>();
  15.800 +      checkConcept<_writer_bits::ItemLabelWriter<UndirEdge>, _LabelWriter>();
  15.801 +      undirEdgeLabelWriter.reset(new _writer_bits::
  15.802 +			      LabelWriter<UndirEdge, _LabelWriter>(_labelWriter));
  15.803 +      edgeLabelWriter.reset(new _writer_bits::
  15.804 +			 LabelWriter<Edge, _LabelWriter>(_labelWriter));
  15.805      }
  15.806  
  15.807      /// \brief Destructor.
  15.808 @@ -1160,48 +1159,47 @@
  15.809  
  15.810    protected:
  15.811  
  15.812 -    /// \brief Header checking function.
  15.813 +    /// \brief The header of the section.
  15.814      ///
  15.815 -    /// It gives back true when the header line start with \c \@undiredges,
  15.816 -    /// and the header line's id and the writer's id are the same.
  15.817 +    /// It gives back the header of the section.
  15.818      virtual std::string header() {
  15.819 -      return "@undiredges " + id;
  15.820 +      return "@undiredges " + name;
  15.821      }
  15.822  
  15.823      /// \brief  Writer function of the section.
  15.824      ///
  15.825      /// Write the content of the section.
  15.826      virtual void write(std::ostream& os) {
  15.827 -      if (!edgeIdWriter->isIdWriter()) {
  15.828 -	throw DataFormatError("Cannot find undirected edgeset or ID map");
  15.829 +      if (!edgeLabelWriter->isLabelWriter()) {
  15.830 +	throw DataFormatError("Cannot find undirected edgeset or label map");
  15.831        }
  15.832 -      if (!undirEdgeIdWriter->isIdWriter()) {
  15.833 -	throw DataFormatError("Cannot find undirected edgeset or ID map");
  15.834 +      if (!undirEdgeLabelWriter->isLabelWriter()) {
  15.835 +	throw DataFormatError("Cannot find undirected edgeset or label map");
  15.836        }
  15.837        for (int i = 0; i < (int)undirEdgeWriters.size(); ++i) {
  15.838  	os << undirEdgeWriters[i].first << ' ';
  15.839 -	undirEdgeIdWriter->write(os, *(undirEdgeWriters[i].second));
  15.840 +	undirEdgeLabelWriter->write(os, *(undirEdgeWriters[i].second));
  15.841  	os << std::endl;
  15.842        }
  15.843        for (int i = 0; i < (int)edgeWriters.size(); ++i) {
  15.844  	os << edgeWriters[i].first << ' ';
  15.845 -	edgeIdWriter->write(os, *(edgeWriters[i].second));
  15.846 +	edgeLabelWriter->write(os, *(edgeWriters[i].second));
  15.847  	os << std::endl;
  15.848        }
  15.849      }
  15.850      
  15.851    private:
  15.852  
  15.853 -    std::string id;
  15.854 +    std::string name;
  15.855  
  15.856      typedef std::vector<std::pair<std::string, 
  15.857  				  const UndirEdge*> > UndirEdgeWriters;
  15.858      UndirEdgeWriters undirEdgeWriters;
  15.859 -    std::auto_ptr<_writer_bits::IdWriterBase<UndirEdge> > undirEdgeIdWriter;
  15.860 +    std::auto_ptr<_writer_bits::LabelWriterBase<UndirEdge> > undirEdgeLabelWriter;
  15.861  
  15.862      typedef std::vector<std::pair<std::string, const Edge*> > EdgeWriters;
  15.863      EdgeWriters edgeWriters;
  15.864 -    std::auto_ptr<_writer_bits::IdWriterBase<Edge> > edgeIdWriter;
  15.865 +    std::auto_ptr<_writer_bits::LabelWriterBase<Edge> > edgeLabelWriter;
  15.866  
  15.867    };
  15.868  
  15.869 @@ -1209,8 +1207,8 @@
  15.870    /// \brief SectionWriter for attributes.
  15.871    ///
  15.872    /// The lemon format can store multiple attribute set. Each set has
  15.873 -  /// the header line \c \@attributes \c attributeset_id, but the 
  15.874 -  /// attributeset_id may be empty.
  15.875 +  /// the header line \c \@attributes \c attributes_name, but the 
  15.876 +  /// attributeset_name may be empty.
  15.877    ///
  15.878    /// The attributeset section contains several lines. Each of them starts
  15.879    /// with the name of attribute and then the value.
  15.880 @@ -1226,8 +1224,8 @@
  15.881      /// Constructor for AttributeWriter. It creates the AttributeWriter and
  15.882      /// attach it into the given LemonWriter.
  15.883      AttributeWriter(LemonWriter& _writer, 
  15.884 -		    const std::string& _id = std::string()) 
  15.885 -      : Parent(_writer), id(_id) {}
  15.886 +		    const std::string& _name = std::string()) 
  15.887 +      : Parent(_writer), name(_name) {}
  15.888  
  15.889      /// \brief Destructor.
  15.890      ///
  15.891 @@ -1248,10 +1246,10 @@
  15.892      ///
  15.893      /// Add an attribute writer command for the writer.
  15.894      template <typename Value>
  15.895 -    AttributeWriter& writeAttribute(const std::string& id, 
  15.896 +    AttributeWriter& writeAttribute(const std::string& name, 
  15.897  				    const Value& value) {
  15.898        return 
  15.899 -	writeAttribute<typename Traits::template Writer<Value> >(id, value);
  15.900 +	writeAttribute<typename Traits::template Writer<Value> >(name, value);
  15.901      }
  15.902  
  15.903      /// \brief Add an attribute writer command for the writer.
  15.904 @@ -1273,7 +1271,7 @@
  15.905      ///
  15.906      /// It gives back the header of the section.
  15.907      std::string header() {
  15.908 -      return "@attributes " + id;
  15.909 +      return "@attributes " + name;
  15.910      }
  15.911  
  15.912      /// \brief  Writer function of the section.
  15.913 @@ -1289,7 +1287,7 @@
  15.914      }    
  15.915  
  15.916    private:
  15.917 -    std::string id;
  15.918 +    std::string name;
  15.919  
  15.920      typedef std::vector<std::pair<std::string, 
  15.921  				  _writer_bits::ValueWriterBase*> > Writers;
    16.1 --- a/test/Makefile.am	Thu Jan 19 16:56:39 2006 +0000
    16.2 +++ b/test/Makefile.am	Tue Jan 24 16:07:38 2006 +0000
    16.3 @@ -10,6 +10,7 @@
    16.4  	graph_utils_test.h \
    16.5  	heap_test.h
    16.6  
    16.7 +
    16.8  check_PROGRAMS = \
    16.9  	all_pairs_shortest_path_test \
   16.10  	bfs_test \
   16.11 @@ -20,9 +21,9 @@
   16.12  	graph_adaptor_test \
   16.13  	graph_utils_test \
   16.14  	kruskal_test \
   16.15 -	max_matching_test \
   16.16  	maps_test \
   16.17  	matrix_maps_test \
   16.18 +	max_matching_test \
   16.19  	min_cost_flow_test \
   16.20  	suurballe_test \
   16.21  	path_test \
    17.1 --- a/test/dijkstra_test.lgf	Thu Jan 19 16:56:39 2006 +0000
    17.2 +++ b/test/dijkstra_test.lgf	Tue Jan 24 16:07:38 2006 +0000
    17.3 @@ -1,5 +1,5 @@
    17.4  @nodeset
    17.5 -id	
    17.6 +label	
    17.7  999	
    17.8  998	
    17.9  997	
   17.10 @@ -1001,7 +1001,7 @@
   17.11  1	
   17.12  0	
   17.13  @edgeset
   17.14 -		id	capacity	
   17.15 +		label	capacity	
   17.16  75	377	6906	27	
   17.17  417	515	6905	69	
   17.18  603	249	6904	80