lemon/lemon_reader.h
changeset 1901 723b2b81d900
parent 1875 98698b69a902
child 1909 2d806130e700
     1.1 --- a/lemon/lemon_reader.h	Thu Jan 19 16:56:39 2006 +0000
     1.2 +++ b/lemon/lemon_reader.h	Tue Jan 24 16:07:38 2006 +0000
     1.3 @@ -47,7 +47,7 @@
     1.4  
     1.5      template <typename T>
     1.6      bool operator<(T, T) {
     1.7 -      throw DataFormatError("Id is not comparable");
     1.8 +      throw DataFormatError("Label is not comparable");
     1.9      }
    1.10  
    1.11      template <typename T>
    1.12 @@ -58,22 +58,22 @@
    1.13      };
    1.14  
    1.15      template <typename Item>
    1.16 -    class ItemIdReader {
    1.17 +    class ItemLabelReader {
    1.18      public:
    1.19  
    1.20 -      bool isIdReader() { return true; }
    1.21 +      bool isLabelReader() { return true; }
    1.22  
    1.23 -      void readId(std::istream&, Item&) {}
    1.24 +      void readLabel(std::istream&, Item&) {}
    1.25        
    1.26 -      template <class _ItemIdReader>
    1.27 +      template <class _ItemLabelReader>
    1.28        struct Constraints {
    1.29  	void constraints() {
    1.30 -	  bool b = reader.isIdReader();
    1.31 +	  bool b = reader.isLabelReader();
    1.32  	  ignore_unused_variable_warning(b);
    1.33  	  Item item;
    1.34 -	  reader.readId(is, item);
    1.35 +	  reader.readLabel(is, item);
    1.36  	}
    1.37 -	_ItemIdReader& reader;
    1.38 +	_ItemLabelReader& reader;
    1.39  	std::istream& is;
    1.40        };
    1.41  
    1.42 @@ -241,7 +241,7 @@
    1.43  	if (it == inverse.end()) {
    1.44  	  inverse.insert(std::make_pair(value, item));
    1.45  	} else {
    1.46 -	  throw DataFormatError("Multiple ID occurence");
    1.47 +	  throw DataFormatError("Multiple label occurence");
    1.48  	}
    1.49        }
    1.50  
    1.51 @@ -252,7 +252,7 @@
    1.52  	if (it != inverse.end()) {
    1.53  	  return it->second;
    1.54  	} else {
    1.55 -	  throw DataFormatError("Invalid ID error");
    1.56 +	  throw DataFormatError("Invalid label error");
    1.57  	}
    1.58        }      
    1.59      };
    1.60 @@ -279,7 +279,7 @@
    1.61  	if (it == inverse.end()) {
    1.62  	  inverse.insert(std::make_pair(value, item));
    1.63  	} else {
    1.64 -	  throw DataFormatError("Multiple ID occurence error");
    1.65 +	  throw DataFormatError("Multiple label occurence error");
    1.66  	}
    1.67        }
    1.68  
    1.69 @@ -290,7 +290,7 @@
    1.70  	if (it != inverse.end()) {
    1.71  	  return it->second;
    1.72  	} else {
    1.73 -	  throw DataFormatError("Invalid ID error");
    1.74 +	  throw DataFormatError("Invalid label error");
    1.75  	}
    1.76        }
    1.77  
    1.78 @@ -370,33 +370,33 @@
    1.79      };
    1.80  
    1.81      template <typename _Item>
    1.82 -    class IdReaderBase {
    1.83 +    class LabelReaderBase {
    1.84      public:
    1.85        typedef _Item Item;
    1.86 -      virtual ~IdReaderBase() {}
    1.87 +      virtual ~LabelReaderBase() {}
    1.88        virtual Item read(std::istream& is) const = 0;
    1.89 -      virtual bool isIdReader() const = 0;
    1.90 +      virtual bool isLabelReader() const = 0;
    1.91      };
    1.92  
    1.93 -    template <typename _Item, typename _BoxedIdReader>
    1.94 -    class IdReader : public IdReaderBase<_Item> {
    1.95 +    template <typename _Item, typename _BoxedLabelReader>
    1.96 +    class LabelReader : public LabelReaderBase<_Item> {
    1.97      public:
    1.98        typedef _Item Item;
    1.99 -      typedef _BoxedIdReader BoxedIdReader;
   1.100 +      typedef _BoxedLabelReader BoxedLabelReader;
   1.101        
   1.102 -      const BoxedIdReader& boxedIdReader;
   1.103 +      const BoxedLabelReader& boxedLabelReader;
   1.104  
   1.105 -      IdReader(const BoxedIdReader& _boxedIdReader) 
   1.106 -	: boxedIdReader(_boxedIdReader) {}
   1.107 +      LabelReader(const BoxedLabelReader& _boxedLabelReader) 
   1.108 +	: boxedLabelReader(_boxedLabelReader) {}
   1.109  
   1.110        virtual Item read(std::istream& is) const {
   1.111  	Item item;
   1.112 -	boxedIdReader.readId(is, item);
   1.113 +	boxedLabelReader.readLabel(is, item);
   1.114  	return item;
   1.115        }
   1.116  
   1.117 -      virtual bool isIdReader() const {
   1.118 -	return boxedIdReader.isIdReader();
   1.119 +      virtual bool isLabelReader() const {
   1.120 +	return boxedLabelReader.isLabelReader();
   1.121        }
   1.122      };
   1.123  
   1.124 @@ -727,16 +727,16 @@
   1.125    /// \brief SectionReader for reading a graph's nodeset.
   1.126    ///
   1.127    /// The lemon format can store multiple graph nodesets with several maps.
   1.128 -  /// The nodeset section's header line is \c \@nodeset \c nodeset_id, but the
   1.129 -  /// \c nodeset_id may be empty.
   1.130 +  /// The nodeset section's header line is \c \@nodeset \c nodeset_name, but the
   1.131 +  /// \c nodeset_name may be empty.
   1.132    ///
   1.133    /// The first line of the section contains the names of the maps separated
   1.134    /// with white spaces. Each next lines describes a node in the nodeset, and
   1.135    /// contains the mapped values for each map.
   1.136    ///
   1.137 -  /// If the nodeset contains an \c "id" named map then it will be regarded
   1.138 +  /// If the nodeset contains an \c "label" named map then it will be regarded
   1.139    /// as id map. This map should contain only unique values and when the 
   1.140 -  /// \c readId() member will read a value from the given stream it will
   1.141 +  /// \c readLabel() member will read a value from the given stream it will
   1.142    /// give back that node which is mapped to this value.
   1.143    ///
   1.144    /// \relates LemonReader
   1.145 @@ -755,12 +755,12 @@
   1.146      /// Constructor for NodeSetReader. It creates the NodeSetReader and
   1.147      /// attach it into the given LemonReader. The nodeset reader will
   1.148      /// add the readed nodes to the given Graph. The reader will read
   1.149 -    /// the section when the \c section_id and the \c _id are the same. 
   1.150 +    /// the section when the \c section_name and the \c _name are the same. 
   1.151      NodeSetReader(LemonReader& _reader, 
   1.152  		  Graph& _graph, 
   1.153 -		  const std::string& _id = std::string(),
   1.154 +		  const std::string& _name = std::string(),
   1.155  		  const DefaultSkipper& _skipper = DefaultSkipper()) 
   1.156 -      : Parent(_reader), graph(_graph), id(_id), skipper(_skipper) {} 
   1.157 +      : Parent(_reader), graph(_graph), name(_name), skipper(_skipper) {} 
   1.158  
   1.159  
   1.160      /// \brief Destructor.
   1.161 @@ -855,11 +855,11 @@
   1.162      /// the section with the given header line.
   1.163      ///
   1.164      /// It gives back true when the header line starts with \c \@nodeset,
   1.165 -    /// and the header line's id and the nodeset's id are the same.
   1.166 +    /// and the header line's name and the nodeset's name are the same.
   1.167      virtual bool header(const std::string& line) {
   1.168        std::istringstream ls(line);
   1.169        std::string command;
   1.170 -      std::string name;
   1.171 +      std::string id;
   1.172        ls >> command >> name;
   1.173        return command == "@nodeset" && name == id;
   1.174      }
   1.175 @@ -872,7 +872,8 @@
   1.176        std::string line;
   1.177  
   1.178        getline(is, line);
   1.179 -      std::istringstream ls(line);	
   1.180 +      std::istringstream ls(line);
   1.181 +      std::string id;
   1.182        while (ls >> id) {
   1.183  	typename MapReaders::iterator it = readers.find(id);
   1.184  	if (it != readers.end()) {
   1.185 @@ -881,7 +882,7 @@
   1.186  	} else {
   1.187  	  index.push_back(&skipper);
   1.188  	}
   1.189 -	if (id == "id" && inverter.get() == 0) {
   1.190 +	if (id == "label" || (id =="id" && inverter.get() == 0)) {
   1.191  	  inverter.reset(index.back()->getInverter());
   1.192  	  index.back() = inverter.get();
   1.193  	}
   1.194 @@ -905,19 +906,19 @@
   1.195  
   1.196    public:
   1.197  
   1.198 -    /// \brief Returns true if the nodeset can give back the node by its id.
   1.199 +    /// \brief Returns true if the nodeset can give back the node by its label.
   1.200      ///
   1.201 -    /// Returns true if the nodeset can give back the node by its id.
   1.202 -    /// It is possible only if an "id" named map was read.
   1.203 -    bool isIdReader() const {
   1.204 +    /// Returns true if the nodeset can give back the node by its label.
   1.205 +    /// It is possible only if an "label" named map was read.
   1.206 +    bool isLabelReader() const {
   1.207        return inverter.get() != 0;
   1.208      }
   1.209  
   1.210 -    /// \brief Gives back the node by its id.
   1.211 +    /// \brief Gives back the node by its label.
   1.212      ///
   1.213      /// It reads an id from the stream and gives back which node belongs to
   1.214 -    /// it. It is possible only if there was read an "id" named map.
   1.215 -    void readId(std::istream& is, Node& node) const {
   1.216 +    /// it. It is possible only if there was read an "label" named map.
   1.217 +    void readLabel(std::istream& is, Node& node) const {
   1.218        node = inverter->read(is);
   1.219      } 
   1.220  
   1.221 @@ -927,7 +928,7 @@
   1.222      MapReaders readers;
   1.223     
   1.224      Graph& graph;   
   1.225 -    std::string id;
   1.226 +    std::string name;
   1.227      _reader_bits::SkipReader<Node, DefaultSkipper> skipper;
   1.228  
   1.229      std::auto_ptr<_reader_bits::MapInverterBase<Node> > inverter;
   1.230 @@ -937,21 +938,21 @@
   1.231    /// \brief SectionReader for reading a graph's edgeset.
   1.232    ///
   1.233    /// The lemon format can store multiple graph edgesets with several maps.
   1.234 -  /// The edgeset section's header line is \c \@edgeset \c edgeset_id, but the
   1.235 -  /// \c edgeset_id may be empty.
   1.236 +  /// The edgeset section's header line is \c \@edgeset \c edgeset_name, but the
   1.237 +  /// \c edgeset_name may be empty.
   1.238    ///
   1.239    /// The first line of the section contains the names of the maps separated
   1.240    /// with white spaces. Each next lines describes an edge in the edgeset. The
   1.241    /// line contains the source and the target nodes' id and the mapped 
   1.242    /// values for each map.
   1.243    ///
   1.244 -  /// If the edgeset contains an \c "id" named map then it will be regarded
   1.245 +  /// If the edgeset contains an \c "label" named map then it will be regarded
   1.246    /// as id map. This map should contain only unique values and when the 
   1.247 -  /// \c readId() member will read a value from the given stream it will
   1.248 +  /// \c readLabel() member will read a value from the given stream it will
   1.249    /// give back that edge which is mapped to this value.
   1.250    ///
   1.251    /// The edgeset reader needs a node id reader to identify which nodes
   1.252 -  /// have to be connected. If a NodeSetReader reads an "id" named map,
   1.253 +  /// have to be connected. If a NodeSetReader reads an "label" named map,
   1.254    /// it will be able to resolve the nodes by ids.
   1.255    ///
   1.256    /// \relates LemonReader
   1.257 @@ -972,18 +973,18 @@
   1.258      /// attach it into the given LemonReader. The edgeset reader will
   1.259      /// add the readed edges to the given Graph. It will use the given
   1.260      /// node id reader to read the source and target nodes of the edges.
   1.261 -    /// The reader will read the section only if the \c _id and the 
   1.262 -    /// \c edgset_id are the same. 
   1.263 -    template <typename NodeIdReader>
   1.264 +    /// The reader will read the section only if the \c _name and the 
   1.265 +    /// \c edgset_name are the same. 
   1.266 +    template <typename NodeLabelReader>
   1.267      EdgeSetReader(LemonReader& _reader, 
   1.268  		  Graph& _graph, 
   1.269 -		  const NodeIdReader& _nodeIdReader, 
   1.270 -		  const std::string& _id = std::string(),
   1.271 +		  const NodeLabelReader& _nodeLabelReader, 
   1.272 +		  const std::string& _name = std::string(),
   1.273  		  const DefaultSkipper& _skipper = DefaultSkipper()) 
   1.274 -      : Parent(_reader), graph(_graph), id(_id), skipper(_skipper) {
   1.275 -      checkConcept<_reader_bits::ItemIdReader<Node>, NodeIdReader>();
   1.276 -      nodeIdReader.reset(new _reader_bits::
   1.277 -			 IdReader<Node, NodeIdReader>(_nodeIdReader));
   1.278 +      : Parent(_reader), graph(_graph), name(_name), skipper(_skipper) {
   1.279 +      checkConcept<_reader_bits::ItemLabelReader<Node>, NodeLabelReader>();
   1.280 +      nodeLabelReader.reset(new _reader_bits::
   1.281 +			 LabelReader<Node, NodeLabelReader>(_nodeLabelReader));
   1.282      }
   1.283      /// \brief Destructor.
   1.284      ///
   1.285 @@ -1077,11 +1078,11 @@
   1.286      /// the section with the given header line.
   1.287      ///
   1.288      /// It gives back true when the header line starts with \c \@edgeset,
   1.289 -    /// and the header line's id and the edgeset's id are the same.
   1.290 +    /// and the header line's name and the edgeset's name are the same.
   1.291      virtual bool header(const std::string& line) {
   1.292        std::istringstream ls(line);
   1.293        std::string command;
   1.294 -      std::string name;
   1.295 +      std::string id;
   1.296        ls >> command >> name;
   1.297        return command == "@edgeset" && name == id;
   1.298      }
   1.299 @@ -1090,14 +1091,15 @@
   1.300      ///
   1.301      /// It reads the content of the section.
   1.302      virtual void read(std::istream& is) {
   1.303 -      if (!nodeIdReader->isIdReader()) {
   1.304 -	throw DataFormatError("Cannot find nodeset or ID map");
   1.305 +      if (!nodeLabelReader->isLabelReader()) {
   1.306 +	throw DataFormatError("Cannot find nodeset or label map");
   1.307        }
   1.308        std::vector<_reader_bits::MapReaderBase<Edge>* > index;
   1.309        std::string line;
   1.310  
   1.311        getline(is, line);
   1.312        std::istringstream ls(line);	
   1.313 +      std::string id;
   1.314        while (ls >> id) {
   1.315  	typename MapReaders::iterator it = readers.find(id);
   1.316  	if (it != readers.end()) {
   1.317 @@ -1106,7 +1108,7 @@
   1.318  	} else {
   1.319  	  index.push_back(&skipper);
   1.320  	}
   1.321 -	if (id == "id" && inverter.get() == 0) {
   1.322 +	if (id == "label" || (id =="id" && inverter.get() == 0)) {
   1.323  	  inverter.reset(index.back()->getInverter());
   1.324  	  index.back() = inverter.get();
   1.325  	}
   1.326 @@ -1121,8 +1123,8 @@
   1.327        }
   1.328        while (getline(is, line)) {	
   1.329  	std::istringstream ls(line);
   1.330 -	Node from = nodeIdReader->read(ls);
   1.331 -	Node to = nodeIdReader->read(ls);
   1.332 +	Node from = nodeLabelReader->read(ls);
   1.333 +	Node to = nodeLabelReader->read(ls);
   1.334  	Edge edge = graph.addEdge(from, to);
   1.335  	for (int i = 0; i < (int)index.size(); ++i) {
   1.336  	  index[i]->read(ls, edge);
   1.337 @@ -1132,19 +1134,19 @@
   1.338  
   1.339    public:
   1.340  
   1.341 -    /// \brief Returns true if the edgeset can give back the edge by its id.
   1.342 +    /// \brief Returns true if the edgeset can give back the edge by its label.
   1.343      ///
   1.344 -    /// Returns true if the edgeset can give back the edge by its id.
   1.345 -    /// It is possible only if an "id" named map was read.
   1.346 -    bool isIdReader() const {
   1.347 +    /// Returns true if the edgeset can give back the edge by its label.
   1.348 +    /// It is possible only if an "label" named map was read.
   1.349 +    bool isLabelReader() const {
   1.350        return inverter.get() != 0;
   1.351      }
   1.352  
   1.353 -    /// \brief Gives back the edge by its id.
   1.354 +    /// \brief Gives back the edge by its label.
   1.355      ///
   1.356      /// It reads an id from the stream and gives back which edge belongs to
   1.357 -    /// it. It is possible only if there was read an "id" named map.
   1.358 -    void readId(std::istream& is, Edge& edge) const {
   1.359 +    /// it. It is possible only if there was read an "label" named map.
   1.360 +    void readLabel(std::istream& is, Edge& edge) const {
   1.361        edge = inverter->read(is);
   1.362      } 
   1.363  
   1.364 @@ -1154,11 +1156,11 @@
   1.365      MapReaders readers;
   1.366     
   1.367      Graph& graph;   
   1.368 -    std::string id;
   1.369 +    std::string name;
   1.370      _reader_bits::SkipReader<Edge, DefaultSkipper> skipper;
   1.371  
   1.372      std::auto_ptr<_reader_bits::MapInverterBase<Edge> > inverter;
   1.373 -    std::auto_ptr<_reader_bits::IdReaderBase<Node> > nodeIdReader;
   1.374 +    std::auto_ptr<_reader_bits::LabelReaderBase<Node> > nodeLabelReader;
   1.375    };
   1.376  
   1.377    /// \ingroup io_group
   1.378 @@ -1166,7 +1168,7 @@
   1.379    ///
   1.380    /// The lemon format can store multiple undirected edgesets with several 
   1.381    /// maps. The undirected edgeset section's header line is \c \@undiredgeset 
   1.382 -  /// \c undiredgeset_id, but the \c undiredgeset_id may be empty.
   1.383 +  /// \c undiredgeset_name, but the \c undiredgeset_name may be empty.
   1.384    ///
   1.385    /// The first line of the section contains the names of the maps separated
   1.386    /// with white spaces. Each next lines describes an edge in the edgeset. The
   1.387 @@ -1178,13 +1180,13 @@
   1.388    /// is near the same just with a prefix \c '+' or \c '-' character 
   1.389    /// difference.
   1.390    ///
   1.391 -  /// If the edgeset contains an \c "id" named map then it will be regarded
   1.392 +  /// If the edgeset contains an \c "label" named map then it will be regarded
   1.393    /// as id map. This map should contain only unique values and when the 
   1.394 -  /// \c readId() member will read a value from the given stream it will
   1.395 +  /// \c readLabel() member will read a value from the given stream it will
   1.396    /// give back that undiricted edge which is mapped to this value.
   1.397    ///
   1.398    /// The undirected edgeset reader needs a node id reader to identify which 
   1.399 -  /// nodes have to be connected. If a NodeSetReader reads an "id" named map,
   1.400 +  /// nodes have to be connected. If a NodeSetReader reads an "label" named map,
   1.401    /// it will be able to resolve the nodes by ids.
   1.402    ///
   1.403    /// \relates LemonReader
   1.404 @@ -1207,17 +1209,17 @@
   1.405      /// reader will add the readed undirected edges to the given Graph. It 
   1.406      /// will use the given node id reader to read the source and target 
   1.407      /// nodes of the edges. The reader will read the section only if the 
   1.408 -    /// \c _id and the \c undiredgset_id are the same. 
   1.409 -    template <typename NodeIdReader>
   1.410 +    /// \c _name and the \c undiredgset_name are the same. 
   1.411 +    template <typename NodeLabelReader>
   1.412      UndirEdgeSetReader(LemonReader& _reader, 
   1.413  		       Graph& _graph, 
   1.414 -		       const NodeIdReader& _nodeIdReader, 
   1.415 -		       const std::string& _id = std::string(),
   1.416 +		       const NodeLabelReader& _nodeLabelReader, 
   1.417 +		       const std::string& _name = std::string(),
   1.418  		       const DefaultSkipper& _skipper = DefaultSkipper()) 
   1.419 -      : Parent(_reader), graph(_graph), id(_id), skipper(_skipper) {
   1.420 -      checkConcept<_reader_bits::ItemIdReader<Node>, NodeIdReader>();
   1.421 -      nodeIdReader.reset(new _reader_bits::
   1.422 -			 IdReader<Node, NodeIdReader>(_nodeIdReader));
   1.423 +      : Parent(_reader), graph(_graph), name(_name), skipper(_skipper) {
   1.424 +      checkConcept<_reader_bits::ItemLabelReader<Node>, NodeLabelReader>();
   1.425 +      nodeLabelReader.reset(new _reader_bits::
   1.426 +			 LabelReader<Node, NodeLabelReader>(_nodeLabelReader));
   1.427      }
   1.428      /// \brief Destructor.
   1.429      ///
   1.430 @@ -1372,11 +1374,11 @@
   1.431      /// the section with the given header line.
   1.432      ///
   1.433      /// It gives back true when the header line starts with \c \@undiredgeset,
   1.434 -    /// and the header line's id and the edgeset's id are the same.
   1.435 +    /// and the header line's name and the edgeset's name are the same.
   1.436      virtual bool header(const std::string& line) {
   1.437        std::istringstream ls(line);
   1.438        std::string command;
   1.439 -      std::string name;
   1.440 +      std::string id;
   1.441        ls >> command >> name;
   1.442        return command == "@undiredgeset" && name == id;
   1.443      }
   1.444 @@ -1385,14 +1387,15 @@
   1.445      ///
   1.446      /// It reads the content of the section.
   1.447      virtual void read(std::istream& is) {
   1.448 -      if (!nodeIdReader->isIdReader()) {
   1.449 -	throw DataFormatError("Cannot find nodeset or ID map");
   1.450 +      if (!nodeLabelReader->isLabelReader()) {
   1.451 +	throw DataFormatError("Cannot find nodeset or label map");
   1.452        }
   1.453        std::vector<_reader_bits::MapReaderBase<UndirEdge>* > index;
   1.454        std::string line;
   1.455  
   1.456        getline(is, line);
   1.457        std::istringstream ls(line);	
   1.458 +      std::string id;
   1.459        while (ls >> id) {
   1.460  	typename MapReaders::iterator it = readers.find(id);
   1.461  	if (it != readers.end()) {
   1.462 @@ -1401,7 +1404,7 @@
   1.463  	} else {
   1.464  	  index.push_back(&skipper);
   1.465  	}
   1.466 -	if (id == "id" && inverter.get() == 0) {
   1.467 +	if (id == "label" || (id =="id" && inverter.get() == 0)) {
   1.468  	  inverter.reset(index.back()->getInverter());
   1.469  	  index.back() = inverter.get();
   1.470  	}
   1.471 @@ -1416,8 +1419,8 @@
   1.472        }
   1.473        while (getline(is, line)) {	
   1.474  	std::istringstream ls(line);
   1.475 -	Node from = nodeIdReader->read(ls);
   1.476 -	Node to = nodeIdReader->read(ls);
   1.477 +	Node from = nodeLabelReader->read(ls);
   1.478 +	Node to = nodeLabelReader->read(ls);
   1.479  	UndirEdge edge = graph.addEdge(from, to);
   1.480  	for (int i = 0; i < (int)index.size(); ++i) {
   1.481  	  index[i]->read(ls, edge);
   1.482 @@ -1427,29 +1430,29 @@
   1.483  
   1.484    public:
   1.485  
   1.486 -    /// \brief Returns true if the edgeset can give back the edge by its id.
   1.487 +    /// \brief Returns true if the edgeset can give back the edge by its label.
   1.488      ///
   1.489      /// Returns true if the edgeset can give back the undirected edge by its 
   1.490 -    /// id. It is possible only if an "id" named map was read.
   1.491 -    bool isIdReader() const {
   1.492 +    /// id. It is possible only if an "label" named map was read.
   1.493 +    bool isLabelReader() const {
   1.494        return inverter.get() != 0;
   1.495      }
   1.496  
   1.497 -    /// \brief Gives back the undirected edge by its id.
   1.498 +    /// \brief Gives back the undirected edge by its label.
   1.499      ///
   1.500      /// It reads an id from the stream and gives back which undirected edge 
   1.501 -    /// belongs to it. It is possible only if there was read an "id" named map.
   1.502 -    void readId(std::istream& is, UndirEdge& undirEdge) const {
   1.503 +    /// belongs to it. It is possible only if there was read an "label" named map.
   1.504 +    void readLabel(std::istream& is, UndirEdge& undirEdge) const {
   1.505        undirEdge = inverter->read(is);
   1.506      } 
   1.507  
   1.508 -    /// \brief Gives back the directed edge by its id.
   1.509 +    /// \brief Gives back the directed edge by its label.
   1.510      ///
   1.511      /// It reads an id from the stream and gives back which directed edge 
   1.512      /// belongs to it. The directed edge id is the \c '+' or \c '-' character
   1.513      /// and the undirected edge id. It is possible only if there was read 
   1.514 -    /// an "id" named map.
   1.515 -    void readId(std::istream& is, Edge& edge) const {
   1.516 +    /// an "label" named map.
   1.517 +    void readLabel(std::istream& is, Edge& edge) const {
   1.518        char c;
   1.519        is >> c;
   1.520        UndirEdge undirEdge = inverter->read(is);
   1.521 @@ -1470,18 +1473,18 @@
   1.522      MapReaders readers;
   1.523     
   1.524      Graph& graph;   
   1.525 -    std::string id;
   1.526 +    std::string name;
   1.527      _reader_bits::SkipReader<UndirEdge, DefaultSkipper> skipper;
   1.528  
   1.529      std::auto_ptr<_reader_bits::MapInverterBase<UndirEdge> > inverter;
   1.530 -    std::auto_ptr<_reader_bits::IdReaderBase<Node> > nodeIdReader;
   1.531 +    std::auto_ptr<_reader_bits::LabelReaderBase<Node> > nodeLabelReader;
   1.532    };
   1.533  
   1.534    /// \ingroup io_group
   1.535    /// \brief SectionReader for reading labeled nodes.
   1.536    ///
   1.537 -  /// The nodes section's header line is \c \@nodes \c nodes_id, but the
   1.538 -  /// \c nodes_id may be empty.
   1.539 +  /// The nodes section's header line is \c \@nodes \c nodes_name, but the
   1.540 +  /// \c nodes_name may be empty.
   1.541    ///
   1.542    /// Each line in the section contains the name of the node 
   1.543    /// and then the node id. 
   1.544 @@ -1499,14 +1502,14 @@
   1.545      /// Constructor for NodeReader. It creates the NodeReader and
   1.546      /// attach it into the given LemonReader. It will use the given
   1.547      /// node id reader to give back the nodes. The reader will read the 
   1.548 -    /// section only if the \c _id and the \c nodes_id are the same. 
   1.549 -    template <typename _IdReader>
   1.550 -    NodeReader(LemonReader& _reader, const _IdReader& _idReader, 
   1.551 -	       const std::string& _id = std::string()) 
   1.552 -      : Parent(_reader), id(_id) {
   1.553 -      checkConcept<_reader_bits::ItemIdReader<Node>, _IdReader>();
   1.554 -      nodeIdReader.reset(new _reader_bits::
   1.555 -			 IdReader<Node, _IdReader>(_idReader));
   1.556 +    /// section only if the \c _name and the \c nodes_name are the same. 
   1.557 +    template <typename _LabelReader>
   1.558 +    NodeReader(LemonReader& _reader, const _LabelReader& _labelReader, 
   1.559 +	       const std::string& _name = std::string()) 
   1.560 +      : Parent(_reader), name(_name) {
   1.561 +      checkConcept<_reader_bits::ItemLabelReader<Node>, _LabelReader>();
   1.562 +      nodeLabelReader.reset(new _reader_bits::
   1.563 +			 LabelReader<Node, _LabelReader>(_labelReader));
   1.564      }
   1.565  
   1.566      /// \brief Destructor.
   1.567 @@ -1538,11 +1541,11 @@
   1.568      /// the section with the given header line.
   1.569      ///
   1.570      /// It gives back true when the header line start with \c \@nodes,
   1.571 -    /// and the header line's id and the reader's id are the same.
   1.572 +    /// and the header line's name and the reader's name are the same.
   1.573      virtual bool header(const std::string& line) {
   1.574        std::istringstream ls(line);
   1.575        std::string command;
   1.576 -      std::string name;
   1.577 +      std::string id;
   1.578        ls >> command >> name;
   1.579        return command == "@nodes" && name == id;
   1.580      }
   1.581 @@ -1551,8 +1554,8 @@
   1.582      ///
   1.583      /// It reads the content of the section.
   1.584      virtual void read(std::istream& is) {
   1.585 -      if (!nodeIdReader->isIdReader()) {
   1.586 -	throw DataFormatError("Cannot find nodeset or ID map");
   1.587 +      if (!nodeLabelReader->isLabelReader()) {
   1.588 +	throw DataFormatError("Cannot find nodeset or label map");
   1.589        }
   1.590        std::string line;
   1.591        while (getline(is, line)) {
   1.592 @@ -1561,7 +1564,7 @@
   1.593  	ls >> id;
   1.594  	typename NodeReaders::iterator it = readers.find(id);
   1.595  	if (it != readers.end()) {
   1.596 -	  it->second.read(nodeIdReader->read(ls));
   1.597 +	  it->second.read(nodeLabelReader->read(ls));
   1.598  	  it->second.touch();
   1.599  	}	
   1.600        }
   1.601 @@ -1577,18 +1580,18 @@
   1.602      
   1.603    private:
   1.604  
   1.605 -    std::string id;
   1.606 +    std::string name;
   1.607  
   1.608      typedef std::map<std::string, _reader_bits::ItemStore<Node> > NodeReaders;
   1.609      NodeReaders readers;
   1.610 -    std::auto_ptr<_reader_bits::IdReaderBase<Node> > nodeIdReader;
   1.611 +    std::auto_ptr<_reader_bits::LabelReaderBase<Node> > nodeLabelReader;
   1.612    };
   1.613  
   1.614    /// \ingroup io_group
   1.615    /// \brief SectionReader for reading labeled edges.
   1.616    ///
   1.617 -  /// The edges section's header line is \c \@edges \c edges_id, but the
   1.618 -  /// \c edges_id may be empty.
   1.619 +  /// The edges section's header line is \c \@edges \c edges_name, but the
   1.620 +  /// \c edges_name may be empty.
   1.621    ///
   1.622    /// Each line in the section contains the name of the edge 
   1.623    /// and then the edge id. 
   1.624 @@ -1606,14 +1609,14 @@
   1.625      /// Constructor for EdgeReader. It creates the EdgeReader and
   1.626      /// attach it into the given LemonReader. It will use the given
   1.627      /// edge id reader to give back the edges. The reader will read the 
   1.628 -    /// section only if the \c _id and the \c edges_id are the same. 
   1.629 -    template <typename _IdReader>
   1.630 -    EdgeReader(LemonReader& _reader, const _IdReader& _idReader, 
   1.631 -	       const std::string& _id = std::string()) 
   1.632 -      : Parent(_reader), id(_id) {
   1.633 -      checkConcept<_reader_bits::ItemIdReader<Edge>, _IdReader>();
   1.634 -      edgeIdReader.reset(new _reader_bits::
   1.635 -			 IdReader<Edge, _IdReader>(_idReader));
   1.636 +    /// section only if the \c _name and the \c edges_name are the same. 
   1.637 +    template <typename _LabelReader>
   1.638 +    EdgeReader(LemonReader& _reader, const _LabelReader& _labelReader, 
   1.639 +	       const std::string& _name = std::string()) 
   1.640 +      : Parent(_reader), name(_name) {
   1.641 +      checkConcept<_reader_bits::ItemLabelReader<Edge>, _LabelReader>();
   1.642 +      edgeLabelReader.reset(new _reader_bits::
   1.643 +			 LabelReader<Edge, _LabelReader>(_labelReader));
   1.644      }
   1.645  
   1.646      /// \brief Destructor.
   1.647 @@ -1644,11 +1647,11 @@
   1.648      /// the section with the given header line.
   1.649      ///
   1.650      /// It gives back true when the header line start with \c \@edges,
   1.651 -    /// and the header line's id and the reader's id are the same.
   1.652 +    /// and the header line's name and the reader's name are the same.
   1.653      virtual bool header(const std::string& line) {
   1.654        std::istringstream ls(line);
   1.655        std::string command;
   1.656 -      std::string name;
   1.657 +      std::string id;
   1.658        ls >> command >> name;
   1.659        return command == "@edges" && name == id;
   1.660      }
   1.661 @@ -1657,8 +1660,8 @@
   1.662      ///
   1.663      /// It reads the content of the section.
   1.664      virtual void read(std::istream& is) {
   1.665 -      if (!edgeIdReader->isIdReader()) {
   1.666 -	throw DataFormatError("Cannot find edgeset or ID map");
   1.667 +      if (!edgeLabelReader->isLabelReader()) {
   1.668 +	throw DataFormatError("Cannot find edgeset or label map");
   1.669        }
   1.670        std::string line;
   1.671        while (getline(is, line)) {
   1.672 @@ -1667,7 +1670,7 @@
   1.673  	ls >> id;
   1.674  	typename EdgeReaders::iterator it = readers.find(id);
   1.675  	if (it != readers.end()) {
   1.676 -	  it->second.read(edgeIdReader->read(ls));
   1.677 +	  it->second.read(edgeLabelReader->read(ls));
   1.678  	  it->second.touch();
   1.679  	}	
   1.680        }
   1.681 @@ -1683,18 +1686,18 @@
   1.682      
   1.683    private:
   1.684  
   1.685 -    std::string id;
   1.686 +    std::string name;
   1.687  
   1.688      typedef std::map<std::string, _reader_bits::ItemStore<Edge> > EdgeReaders;
   1.689      EdgeReaders readers;
   1.690 -    std::auto_ptr<_reader_bits::IdReaderBase<Edge> > edgeIdReader;
   1.691 +    std::auto_ptr<_reader_bits::LabelReaderBase<Edge> > edgeLabelReader;
   1.692    };
   1.693  
   1.694    /// \ingroup io_group
   1.695    /// \brief SectionReader for reading labeled undirected edges.
   1.696    ///
   1.697    /// The undirected edges section's header line is \c \@undiredges 
   1.698 -  /// \c undiredges_id, but the \c undiredges_id may be empty.
   1.699 +  /// \c undiredges_name, but the \c undiredges_name may be empty.
   1.700    ///
   1.701    /// Each line in the section contains the name of the undirected edge 
   1.702    /// and then the undirected edge id. 
   1.703 @@ -1713,18 +1716,18 @@
   1.704      /// Constructor for UndirEdgeReader. It creates the UndirEdgeReader and
   1.705      /// attach it into the given LemonReader. It will use the given
   1.706      /// undirected edge id reader to give back the edges. The reader will 
   1.707 -    /// read the section only if the \c _id and the \c undiredges_id are 
   1.708 +    /// read the section only if the \c _name and the \c undiredges_name are 
   1.709      /// the same. 
   1.710 -    template <typename _IdReader>
   1.711 -    UndirEdgeReader(LemonReader& _reader, const _IdReader& _idReader, 
   1.712 -	       const std::string& _id = std::string()) 
   1.713 -      : Parent(_reader), id(_id) {
   1.714 -      checkConcept<_reader_bits::ItemIdReader<UndirEdge>, _IdReader>();
   1.715 -      checkConcept<_reader_bits::ItemIdReader<Edge>, _IdReader>();
   1.716 -      undirEdgeIdReader.reset(new _reader_bits::
   1.717 -			      IdReader<UndirEdge, _IdReader>(_idReader));
   1.718 -      edgeIdReader.reset(new _reader_bits::
   1.719 -			 IdReader<Edge, _IdReader>(_idReader));
   1.720 +    template <typename _LabelReader>
   1.721 +    UndirEdgeReader(LemonReader& _reader, const _LabelReader& _labelReader, 
   1.722 +	       const std::string& _name = std::string()) 
   1.723 +      : Parent(_reader), name(_name) {
   1.724 +      checkConcept<_reader_bits::ItemLabelReader<UndirEdge>, _LabelReader>();
   1.725 +      checkConcept<_reader_bits::ItemLabelReader<Edge>, _LabelReader>();
   1.726 +      undirEdgeLabelReader.reset(new _reader_bits::
   1.727 +			      LabelReader<UndirEdge, _LabelReader>(_labelReader));
   1.728 +      edgeLabelReader.reset(new _reader_bits::
   1.729 +			 LabelReader<Edge, _LabelReader>(_labelReader));
   1.730      }
   1.731  
   1.732      /// \brief Destructor.
   1.733 @@ -1768,11 +1771,11 @@
   1.734      /// the section with the given header line.
   1.735      ///
   1.736      /// It gives back true when the header line start with \c \@edges,
   1.737 -    /// and the header line's id and the reader's id are the same.
   1.738 +    /// and the header line's name and the reader's name are the same.
   1.739      virtual bool header(const std::string& line) {
   1.740        std::istringstream ls(line);
   1.741        std::string command;
   1.742 -      std::string name;
   1.743 +      std::string id;
   1.744        ls >> command >> name;
   1.745        return command == "@undiredges" && name == id;
   1.746      }
   1.747 @@ -1781,11 +1784,11 @@
   1.748      ///
   1.749      /// It reads the content of the section.
   1.750      virtual void read(std::istream& is) {
   1.751 -      if (!edgeIdReader->isIdReader()) {
   1.752 -	throw DataFormatError("Cannot find undirected edgeset or ID map");
   1.753 +      if (!edgeLabelReader->isLabelReader()) {
   1.754 +	throw DataFormatError("Cannot find undirected edgeset or label map");
   1.755        }
   1.756 -      if (!undirEdgeIdReader->isIdReader()) {
   1.757 -	throw DataFormatError("Cannot find undirected edgeset or ID map");
   1.758 +      if (!undirEdgeLabelReader->isLabelReader()) {
   1.759 +	throw DataFormatError("Cannot find undirected edgeset or label map");
   1.760        }
   1.761        std::string line;
   1.762        while (getline(is, line)) {
   1.763 @@ -1795,14 +1798,14 @@
   1.764  	{
   1.765  	  typename UndirEdgeReaders::iterator it = undirEdgeReaders.find(id);
   1.766  	  if (it != undirEdgeReaders.end()) {
   1.767 -	    it->second.read(undirEdgeIdReader->read(ls));
   1.768 +	    it->second.read(undirEdgeLabelReader->read(ls));
   1.769  	    it->second.touch();
   1.770  	    continue;
   1.771  	  }	
   1.772  	} {
   1.773  	  typename EdgeReaders::iterator it = edgeReaders.find(id);
   1.774  	  if (it != edgeReaders.end()) {
   1.775 -	    it->second.read(edgeIdReader->read(ls));
   1.776 +	    it->second.read(edgeLabelReader->read(ls));
   1.777  	    it->second.touch();
   1.778  	    continue;
   1.779  	  }	
   1.780 @@ -1828,24 +1831,24 @@
   1.781      
   1.782    private:
   1.783  
   1.784 -    std::string id;
   1.785 +    std::string name;
   1.786  
   1.787      typedef std::map<std::string, 
   1.788  		     _reader_bits::ItemStore<UndirEdge> > UndirEdgeReaders;
   1.789      UndirEdgeReaders undirEdgeReaders;
   1.790 -    std::auto_ptr<_reader_bits::IdReaderBase<UndirEdge> > undirEdgeIdReader;
   1.791 +    std::auto_ptr<_reader_bits::LabelReaderBase<UndirEdge> > undirEdgeLabelReader;
   1.792  
   1.793      typedef std::map<std::string, _reader_bits::ItemStore<Edge> > EdgeReaders;
   1.794      EdgeReaders edgeReaders;
   1.795 -    std::auto_ptr<_reader_bits::IdReaderBase<Edge> > edgeIdReader;
   1.796 +    std::auto_ptr<_reader_bits::LabelReaderBase<Edge> > edgeLabelReader;
   1.797    };
   1.798  
   1.799    /// \ingroup io_group
   1.800    /// \brief SectionReader for attributes.
   1.801    ///
   1.802    /// The lemon format can store multiple attribute set. Each set has
   1.803 -  /// the header line \c \@attributes \c attributeset_id, but the 
   1.804 -  /// attributeset_id may be empty.
   1.805 +  /// the header line \c \@attributes \c attributeset_name, but the 
   1.806 +  /// attributeset_name may be empty.
   1.807    ///
   1.808    /// The attributeset section contains several lines. Each of them starts
   1.809    /// with an attribute and then a the value for the id.
   1.810 @@ -1860,10 +1863,10 @@
   1.811      ///
   1.812      /// Constructor for AttributeReader. It creates the AttributeReader and
   1.813      /// attach it into the given LemonReader. The reader process a section
   1.814 -    /// only if the \c section_id and the \c _id are the same.
   1.815 +    /// only if the \c section_name and the \c _name are the same.
   1.816      AttributeReader(LemonReader& _reader, 
   1.817 -		    const std::string& _id = std::string()) 
   1.818 -      : Parent(_reader), id(_id) {}
   1.819 +		    const std::string& _name = std::string()) 
   1.820 +      : Parent(_reader), name(_name) {}
   1.821  
   1.822      /// \brief Destructor.
   1.823      ///
   1.824 @@ -1916,7 +1919,7 @@
   1.825      bool header(const std::string& line) {
   1.826        std::istringstream ls(line);
   1.827        std::string command;
   1.828 -      std::string name;
   1.829 +      std::string id;
   1.830        ls >> command >> name;
   1.831        return command == "@attributes" && name == id;
   1.832      }
   1.833 @@ -1933,7 +1936,7 @@
   1.834  	typename Readers::iterator it = readers.find(id);
   1.835  	if (it != readers.end()) {
   1.836  	  it->second->read(ls);
   1.837 -	  it->second->touch();
   1.838 + 	  it->second->touch();
   1.839  	}
   1.840        }
   1.841        for (typename Readers::iterator it = readers.begin();
   1.842 @@ -1947,7 +1950,7 @@
   1.843      }    
   1.844  
   1.845    private:
   1.846 -    std::string id;
   1.847 +    std::string name;
   1.848  
   1.849      typedef std::map<std::string, _reader_bits::ValueReaderBase*> Readers;
   1.850      Readers readers;  
   1.851 @@ -2203,21 +2206,21 @@
   1.852    private:
   1.853  
   1.854      void readMapNames(std::istream& is, std::vector<std::string>& maps) {
   1.855 -      std::string line, id;
   1.856 +      std::string line, name;
   1.857        std::getline(is, line);
   1.858        std::istringstream ls(line);
   1.859 -      while (ls >> id) {
   1.860 -	maps.push_back(id);
   1.861 +      while (ls >> name) {
   1.862 +	maps.push_back(name);
   1.863        }
   1.864        while (getline(is, line));
   1.865      }
   1.866  
   1.867      void readItemNames(std::istream& is, std::vector<std::string>& maps) {
   1.868 -      std::string line, id;
   1.869 +      std::string line, name;
   1.870        while (std::getline(is, line)) {
   1.871  	std::istringstream ls(line);
   1.872 -	ls >> id;
   1.873 -	maps.push_back(id);
   1.874 +	ls >> name;
   1.875 +	maps.push_back(name);
   1.876        }
   1.877      }
   1.878