Index: lemon/lgf_reader.h
===================================================================
--- lemon/lgf_reader.h	(revision 201)
+++ lemon/lgf_reader.h	(revision 209)
@@ -1,5 +1,5 @@
-/* -*- C++ -*-
+/* -*- mode: C++; indent-tabs-mode: nil; -*-
  *
- * This file is a part of LEMON, a generic C++ optimization library
+ * This file is a part of LEMON, a generic C++ optimization library.
  *
  * Copyright (C) 2003-2008
@@ -47,13 +47,13 @@
     struct DefaultConverter {
       Value operator()(const std::string& str) {
-	std::istringstream is(str);
-	Value value;
-	is >> value;
-
-	char c;
-	if (is >> std::ws >> c) {
-	  throw DataFormatError("Remaining characters in token");
-	}
-	return value;
+        std::istringstream is(str);
+        Value value;
+        is >> value;
+
+        char c;
+        if (is >> std::ws >> c) {
+          throw DataFormatError("Remaining characters in token");
+        }
+        return value;
       }
     };
@@ -62,9 +62,9 @@
     struct DefaultConverter<std::string> {
       std::string operator()(const std::string& str) {
-	return str;
+        return str;
       }
     };
 
-    template <typename _Item>    
+    template <typename _Item>
     class MapStorageBase {
     public:
@@ -79,6 +79,6 @@
     };
 
-    template <typename _Item, typename _Map, 
-	      typename _Converter = DefaultConverter<typename _Map::Value> >
+    template <typename _Item, typename _Map,
+              typename _Converter = DefaultConverter<typename _Map::Value> >
     class MapStorage : public MapStorageBase<_Item> {
     public:
@@ -86,5 +86,5 @@
       typedef _Converter Converter;
       typedef _Item Item;
-      
+
     private:
       Map& _map;
@@ -92,15 +92,15 @@
 
     public:
-      MapStorage(Map& map, const Converter& converter = Converter()) 
-	: _map(map), _converter(converter) {}
+      MapStorage(Map& map, const Converter& converter = Converter())
+        : _map(map), _converter(converter) {}
       virtual ~MapStorage() {}
 
       virtual void set(const Item& item ,const std::string& value) {
-	_map.set(item, _converter(value));
+        _map.set(item, _converter(value));
       }
     };
 
-    template <typename _Graph, bool _dir, typename _Map, 
-	      typename _Converter = DefaultConverter<typename _Map::Value> >
+    template <typename _Graph, bool _dir, typename _Map,
+              typename _Converter = DefaultConverter<typename _Map::Value> >
     class GraphArcMapStorage : public MapStorageBase<typename _Graph::Edge> {
     public:
@@ -110,5 +110,5 @@
       typedef typename Graph::Edge Item;
       static const bool dir = _dir;
-      
+
     private:
       const Graph& _graph;
@@ -117,11 +117,11 @@
 
     public:
-      GraphArcMapStorage(const Graph& graph, Map& map, 
-			 const Converter& converter = Converter()) 
-	: _graph(graph), _map(map), _converter(converter) {}
+      GraphArcMapStorage(const Graph& graph, Map& map,
+                         const Converter& converter = Converter())
+        : _graph(graph), _map(map), _converter(converter) {}
       virtual ~GraphArcMapStorage() {}
 
       virtual void set(const Item& item ,const std::string& value) {
-	_map.set(_graph.direct(item, dir), _converter(value));
+        _map.set(_graph.direct(item, dir), _converter(value));
       }
     };
@@ -147,8 +147,8 @@
     public:
       ValueStorage(Value& value, const Converter& converter = Converter())
- 	: _value(value), _converter(converter) {}
+         : _value(value), _converter(converter) {}
 
       virtual void set(const std::string& value) {
-	_value = _converter(value);
+        _value = _converter(value);
       }
     };
@@ -177,32 +177,32 @@
       const Graph& _graph;
       const std::map<std::string, typename Graph::Edge>& _map;
-      
-      GraphArcLookUpConverter(const Graph& graph, 
-			      const std::map<std::string,
-			                     typename Graph::Edge>& map) 
-	: _graph(graph), _map(map) {}
-      
+
+      GraphArcLookUpConverter(const Graph& graph,
+                              const std::map<std::string,
+                                             typename Graph::Edge>& map)
+        : _graph(graph), _map(map) {}
+
       typename Graph::Arc operator()(const std::string& str) {
-	if (str.empty() || (str[0] != '+' && str[0] != '-')) {
-	  throw DataFormatError("Item must start with '+' or '-'");
-	}
-	typename std::map<std::string, typename Graph::Edge>
-	  ::const_iterator it = _map.find(str.substr(1));
-	if (it == _map.end()) {
-	  throw DataFormatError("Item not found");
-	}
-	return _graph.direct(it->second, str[0] == '+');
+        if (str.empty() || (str[0] != '+' && str[0] != '-')) {
+          throw DataFormatError("Item must start with '+' or '-'");
+        }
+        typename std::map<std::string, typename Graph::Edge>
+          ::const_iterator it = _map.find(str.substr(1));
+        if (it == _map.end()) {
+          throw DataFormatError("Item not found");
+        }
+        return _graph.direct(it->second, str[0] == '+');
       }
     };
 
     inline bool isWhiteSpace(char c) {
-      return c == ' ' || c == '\t' || c == '\v' || 
-        c == '\n' || c == '\r' || c == '\f'; 
-    }
-    
+      return c == ' ' || c == '\t' || c == '\v' ||
+        c == '\n' || c == '\r' || c == '\f';
+    }
+
     inline bool isOct(char c) {
-      return '0' <= c && c <='7'; 
-    }
-    
+      return '0' <= c && c <='7';
+    }
+
     inline int valueOct(char c) {
       LEMON_ASSERT(isOct(c), "The character is not octal.");
@@ -211,9 +211,9 @@
 
     inline bool isHex(char c) {
-      return ('0' <= c && c <= '9') || 
-	('a' <= c && c <= 'z') || 
-	('A' <= c && c <= 'Z'); 
-    }
-    
+      return ('0' <= c && c <= '9') ||
+        ('a' <= c && c <= 'z') ||
+        ('A' <= c && c <= 'Z');
+    }
+
     inline int valueHex(char c) {
       LEMON_ASSERT(isHex(c), "The character is not hexadecimal.");
@@ -225,10 +225,10 @@
     inline bool isIdentifierFirstChar(char c) {
       return ('a' <= c && c <= 'z') ||
-	('A' <= c && c <= 'Z') || c == '_';
+        ('A' <= c && c <= 'Z') || c == '_';
     }
 
     inline bool isIdentifierChar(char c) {
       return isIdentifierFirstChar(c) ||
-	('0' <= c && c <= '9');
+        ('0' <= c && c <= '9');
     }
 
@@ -236,53 +236,53 @@
       char c;
       if (!is.get(c))
-	throw DataFormatError("Escape format error");
+        throw DataFormatError("Escape format error");
 
       switch (c) {
       case '\\':
-	return '\\';
+        return '\\';
       case '\"':
-	return '\"';
+        return '\"';
       case '\'':
-	return '\'';
+        return '\'';
       case '\?':
-	return '\?';
+        return '\?';
       case 'a':
-	return '\a';
+        return '\a';
       case 'b':
-	return '\b';
+        return '\b';
       case 'f':
-	return '\f';
+        return '\f';
       case 'n':
-	return '\n';
+        return '\n';
       case 'r':
-	return '\r';
+        return '\r';
       case 't':
-	return '\t';
+        return '\t';
       case 'v':
-	return '\v';
+        return '\v';
       case 'x':
-	{
-	  int code;
-	  if (!is.get(c) || !isHex(c)) 
-	    throw DataFormatError("Escape format error");
-	  else if (code = valueHex(c), !is.get(c) || !isHex(c)) is.putback(c);
-	  else code = code * 16 + valueHex(c);
-	  return code;
-	}
+        {
+          int code;
+          if (!is.get(c) || !isHex(c))
+            throw DataFormatError("Escape format error");
+          else if (code = valueHex(c), !is.get(c) || !isHex(c)) is.putback(c);
+          else code = code * 16 + valueHex(c);
+          return code;
+        }
       default:
-	{
-	  int code;
-	  if (!isOct(c)) 
-	    throw DataFormatError("Escape format error");
-	  else if (code = valueOct(c), !is.get(c) || !isOct(c)) 
-	    is.putback(c);
-	  else if (code = code * 8 + valueOct(c), !is.get(c) || !isOct(c)) 
-	    is.putback(c);
-	  else code = code * 8 + valueOct(c);
-	  return code;
-	}	      
-      } 
-    }
-    
+        {
+          int code;
+          if (!isOct(c))
+            throw DataFormatError("Escape format error");
+          else if (code = valueOct(c), !is.get(c) || !isOct(c))
+            is.putback(c);
+          else if (code = code * 8 + valueOct(c), !is.get(c) || !isOct(c))
+            is.putback(c);
+          else code = code * 8 + valueOct(c);
+          return code;
+        }
+      }
+    }
+
     inline std::istream& readToken(std::istream& is, std::string& str) {
       std::ostringstream os;
@@ -290,28 +290,28 @@
       char c;
       is >> std::ws;
-      
-      if (!is.get(c)) 
-	return is;
+
+      if (!is.get(c))
+        return is;
 
       if (c == '\"') {
-	while (is.get(c) && c != '\"') {
-	  if (c == '\\') 
-	    c = readEscape(is);
-	  os << c;
-	}
-	if (!is) 
-	  throw DataFormatError("Quoted format error");
+        while (is.get(c) && c != '\"') {
+          if (c == '\\')
+            c = readEscape(is);
+          os << c;
+        }
+        if (!is)
+          throw DataFormatError("Quoted format error");
       } else {
-	is.putback(c);
-	while (is.get(c) && !isWhiteSpace(c)) {
-	  if (c == '\\') 
-	    c = readEscape(is);
-	  os << c;
-	}
-	if (!is) {
-	  is.clear();
-	} else {
-	  is.putback(c);
-	}
+        is.putback(c);
+        while (is.get(c) && !isWhiteSpace(c)) {
+          if (c == '\\')
+            c = readEscape(is);
+          os << c;
+        }
+        if (!is) {
+          is.clear();
+        } else {
+          is.putback(c);
+        }
       }
       str = os.str();
@@ -332,26 +332,26 @@
 
     public:
-      
+
       LineSection(const Functor& functor) : _functor(functor) {}
       virtual ~LineSection() {}
 
       virtual void process(std::istream& is, int& line_num) {
-	char c;
-	std::string line;
-	while (is.get(c) && c != '@') {
-	  if (c == '\n') {
-	    ++line_num;
-	  } else if (c == '#') {
-	    getline(is, line);
-	    ++line_num;
-	  } else if (!isWhiteSpace(c)) {
-	    is.putback(c);
-	    getline(is, line);
-	    _functor(line);
-	    ++line_num;
-	  }
-	}
-	if (is) is.putback(c);
-	else if (is.eof()) is.clear();
+        char c;
+        std::string line;
+        while (is.get(c) && c != '@') {
+          if (c == '\n') {
+            ++line_num;
+          } else if (c == '#') {
+            getline(is, line);
+            ++line_num;
+          } else if (!isWhiteSpace(c)) {
+            is.putback(c);
+            getline(is, line);
+            _functor(line);
+            ++line_num;
+          }
+        }
+        if (is) is.putback(c);
+        else if (is.eof()) is.clear();
       }
     };
@@ -364,25 +364,25 @@
 
     public:
-      
+
       StreamSection(const Functor& functor) : _functor(functor) {}
-      virtual ~StreamSection() {} 
+      virtual ~StreamSection() {}
 
       virtual void process(std::istream& is, int& line_num) {
-	_functor(is, line_num);
-	char c;
-	std::string line;
-	while (is.get(c) && c != '@') {
-	  if (c == '\n') {
-	    ++line_num;
-	  } else if (!isWhiteSpace(c)) {
-	    getline(is, line);
-	    ++line_num;
-	  }
-	}
-	if (is) is.putback(c);
-	else if (is.eof()) is.clear();	
+        _functor(is, line_num);
+        char c;
+        std::string line;
+        while (is.get(c) && c != '@') {
+          if (c == '\n') {
+            ++line_num;
+          } else if (!isWhiteSpace(c)) {
+            getline(is, line);
+            ++line_num;
+          }
+        }
+        if (is) is.putback(c);
+        else if (is.eof()) is.clear();
       }
     };
-    
+
   }
 
@@ -400,5 +400,5 @@
 
   /// \ingroup lemon_io
-  ///  
+  ///
   /// \brief \ref lgf-format "LGF" reader for directed graphs
   ///
@@ -454,5 +454,5 @@
     typedef _Digraph Digraph;
     TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
-    
+
   private:
 
@@ -471,8 +471,8 @@
     typedef std::map<std::string, Arc> ArcIndex;
     ArcIndex _arc_index;
-    
-    typedef std::vector<std::pair<std::string, 
-      _reader_bits::MapStorageBase<Node>*> > NodeMaps;    
-    NodeMaps _node_maps; 
+
+    typedef std::vector<std::pair<std::string,
+      _reader_bits::MapStorageBase<Node>*> > NodeMaps;
+    NodeMaps _node_maps;
 
     typedef std::vector<std::pair<std::string,
@@ -480,5 +480,5 @@
     ArcMaps _arc_maps;
 
-    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*> 
+    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*>
       Attributes;
     Attributes _attributes;
@@ -499,8 +499,8 @@
     /// Construct a directed graph reader, which reads from the given
     /// input stream.
-    DigraphReader(std::istream& is, Digraph& digraph) 
+    DigraphReader(std::istream& is, Digraph& digraph)
       : _is(&is), local_is(false), _digraph(digraph),
-	_use_nodes(false), _use_arcs(false),
-	_skip_nodes(false), _skip_arcs(false) {}
+        _use_nodes(false), _use_arcs(false),
+        _skip_nodes(false), _skip_arcs(false) {}
 
     /// \brief Constructor
@@ -508,37 +508,37 @@
     /// Construct a directed graph reader, which reads from the given
     /// file.
-    DigraphReader(const std::string& fn, Digraph& digraph) 
+    DigraphReader(const std::string& fn, Digraph& digraph)
       : _is(new std::ifstream(fn.c_str())), local_is(true), _digraph(digraph),
-    	_use_nodes(false), _use_arcs(false),
-	_skip_nodes(false), _skip_arcs(false) {}
-    
+            _use_nodes(false), _use_arcs(false),
+        _skip_nodes(false), _skip_arcs(false) {}
+
     /// \brief Constructor
     ///
     /// Construct a directed graph reader, which reads from the given
     /// file.
-    DigraphReader(const char* fn, Digraph& digraph) 
+    DigraphReader(const char* fn, Digraph& digraph)
       : _is(new std::ifstream(fn)), local_is(true), _digraph(digraph),
-    	_use_nodes(false), _use_arcs(false),
-	_skip_nodes(false), _skip_arcs(false) {}
+            _use_nodes(false), _use_arcs(false),
+        _skip_nodes(false), _skip_arcs(false) {}
 
     /// \brief Destructor
     ~DigraphReader() {
-      for (typename NodeMaps::iterator it = _node_maps.begin(); 
-	   it != _node_maps.end(); ++it) {
-	delete it->second;
-      }
-
-      for (typename ArcMaps::iterator it = _arc_maps.begin(); 
-	   it != _arc_maps.end(); ++it) {
-	delete it->second;
-      }
-
-      for (typename Attributes::iterator it = _attributes.begin(); 
-	   it != _attributes.end(); ++it) {
-	delete it->second;
+      for (typename NodeMaps::iterator it = _node_maps.begin();
+           it != _node_maps.end(); ++it) {
+        delete it->second;
+      }
+
+      for (typename ArcMaps::iterator it = _arc_maps.begin();
+           it != _arc_maps.end(); ++it) {
+        delete it->second;
+      }
+
+      for (typename Attributes::iterator it = _attributes.begin();
+           it != _attributes.end(); ++it) {
+        delete it->second;
       }
 
       if (local_is) {
-	delete _is;
+        delete _is;
       }
 
@@ -547,19 +547,19 @@
   private:
 
-    friend DigraphReader<Digraph> digraphReader<>(std::istream& is, 
-						  Digraph& digraph);    
-    friend DigraphReader<Digraph> digraphReader<>(const std::string& fn, 
-						  Digraph& digraph);   
-    friend DigraphReader<Digraph> digraphReader<>(const char *fn, 
-						  Digraph& digraph);    
-
-    DigraphReader(DigraphReader& other) 
+    friend DigraphReader<Digraph> digraphReader<>(std::istream& is,
+                                                  Digraph& digraph);
+    friend DigraphReader<Digraph> digraphReader<>(const std::string& fn,
+                                                  Digraph& digraph);
+    friend DigraphReader<Digraph> digraphReader<>(const char *fn,
+                                                  Digraph& digraph);
+
+    DigraphReader(DigraphReader& other)
       : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
-	_use_nodes(other._use_nodes), _use_arcs(other._use_arcs),
-	_skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
+        _use_nodes(other._use_nodes), _use_arcs(other._use_arcs),
+        _skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
 
       other._is = 0;
       other.local_is = false;
-      
+
       _node_index.swap(other._node_index);
       _arc_index.swap(other._arc_index);
@@ -581,5 +581,5 @@
     /// \name Reading rules
     /// @{
-    
+
     /// \brief Node map reading rule
     ///
@@ -588,6 +588,6 @@
     DigraphReader& nodeMap(const std::string& caption, Map& map) {
       checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Node>* storage = 
-	new _reader_bits::MapStorage<Node, Map>(map);
+      _reader_bits::MapStorageBase<Node>* storage =
+        new _reader_bits::MapStorage<Node, Map>(map);
       _node_maps.push_back(std::make_pair(caption, storage));
       return *this;
@@ -599,9 +599,9 @@
     /// reader.
     template <typename Map, typename Converter>
-    DigraphReader& nodeMap(const std::string& caption, Map& map, 
-			   const Converter& converter = Converter()) {
+    DigraphReader& nodeMap(const std::string& caption, Map& map,
+                           const Converter& converter = Converter()) {
       checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Node>* storage = 
-	new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
+      _reader_bits::MapStorageBase<Node>* storage =
+        new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
       _node_maps.push_back(std::make_pair(caption, storage));
       return *this;
@@ -614,6 +614,6 @@
     DigraphReader& arcMap(const std::string& caption, Map& map) {
       checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Arc>* storage = 
-	new _reader_bits::MapStorage<Arc, Map>(map);
+      _reader_bits::MapStorageBase<Arc>* storage =
+        new _reader_bits::MapStorage<Arc, Map>(map);
       _arc_maps.push_back(std::make_pair(caption, storage));
       return *this;
@@ -625,9 +625,9 @@
     /// reader.
     template <typename Map, typename Converter>
-    DigraphReader& arcMap(const std::string& caption, Map& map, 
-			  const Converter& converter = Converter()) {
+    DigraphReader& arcMap(const std::string& caption, Map& map,
+                          const Converter& converter = Converter()) {
       checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Arc>* storage = 
-	new _reader_bits::MapStorage<Arc, Map, Converter>(map, converter);
+      _reader_bits::MapStorageBase<Arc>* storage =
+        new _reader_bits::MapStorage<Arc, Map, Converter>(map, converter);
       _arc_maps.push_back(std::make_pair(caption, storage));
       return *this;
@@ -639,6 +639,6 @@
     template <typename Value>
     DigraphReader& attribute(const std::string& caption, Value& value) {
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Value>(value);
+      _reader_bits::ValueStorageBase* storage =
+        new _reader_bits::ValueStorage<Value>(value);
       _attributes.insert(std::make_pair(caption, storage));
       return *this;
@@ -650,8 +650,8 @@
     /// reader.
     template <typename Value, typename Converter>
-    DigraphReader& attribute(const std::string& caption, Value& value, 
-			     const Converter& converter = Converter()) {
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Value, Converter>(value, converter);
+    DigraphReader& attribute(const std::string& caption, Value& value,
+                             const Converter& converter = Converter()) {
+      _reader_bits::ValueStorageBase* storage =
+        new _reader_bits::ValueStorage<Value, Converter>(value, converter);
       _attributes.insert(std::make_pair(caption, storage));
       return *this;
@@ -664,6 +664,6 @@
       typedef _reader_bits::MapLookUpConverter<Node> Converter;
       Converter converter(_node_index);
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Node, Converter>(node, converter);
+      _reader_bits::ValueStorageBase* storage =
+        new _reader_bits::ValueStorage<Node, Converter>(node, converter);
       _attributes.insert(std::make_pair(caption, storage));
       return *this;
@@ -676,6 +676,6 @@
       typedef _reader_bits::MapLookUpConverter<Arc> Converter;
       Converter converter(_arc_index);
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
+      _reader_bits::ValueStorageBase* storage =
+        new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
       _attributes.insert(std::make_pair(caption, storage));
       return *this;
@@ -723,9 +723,9 @@
     DigraphReader& useNodes(const Map& map) {
       checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
-      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
+      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
       _use_nodes = true;
       _writer_bits::DefaultConverter<typename Map::Value> converter;
       for (NodeIt n(_digraph); n != INVALID; ++n) {
-	_node_index.insert(std::make_pair(converter(map[n]), n));
+        _node_index.insert(std::make_pair(converter(map[n]), n));
       }
       return *this;
@@ -738,11 +738,11 @@
     /// \c std::string.
     template <typename Map, typename Converter>
-    DigraphReader& useNodes(const Map& map, 
-			    const Converter& converter = Converter()) {
+    DigraphReader& useNodes(const Map& map,
+                            const Converter& converter = Converter()) {
       checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
-      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
+      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
       _use_nodes = true;
       for (NodeIt n(_digraph); n != INVALID; ++n) {
-	_node_index.insert(std::make_pair(converter(map[n]), n));
+        _node_index.insert(std::make_pair(converter(map[n]), n));
       }
       return *this;
@@ -760,5 +760,5 @@
       _writer_bits::DefaultConverter<typename Map::Value> converter;
       for (ArcIt a(_digraph); a != INVALID; ++a) {
-	_arc_index.insert(std::make_pair(converter(map[a]), a));
+        _arc_index.insert(std::make_pair(converter(map[a]), a));
       }
       return *this;
@@ -771,11 +771,11 @@
     /// \c std::string.
     template <typename Map, typename Converter>
-    DigraphReader& useArcs(const Map& map, 
-			   const Converter& converter = Converter()) {
+    DigraphReader& useArcs(const Map& map,
+                           const Converter& converter = Converter()) {
       checkConcept<concepts::ReadMap<Arc, typename Map::Value>, Map>();
-      LEMON_ASSERT(!_use_arcs, "Multiple usage of useArcs() member"); 
+      LEMON_ASSERT(!_use_arcs, "Multiple usage of useArcs() member");
       _use_arcs = true;
       for (ArcIt a(_digraph); a != INVALID; ++a) {
-	_arc_index.insert(std::make_pair(converter(map[a]), a));
+        _arc_index.insert(std::make_pair(converter(map[a]), a));
       }
       return *this;
@@ -791,5 +791,5 @@
     /// \c useNodes() should be used to specify the label of the nodes.
     DigraphReader& skipNodes() {
-      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set"); 
+      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set");
       _skip_nodes = true;
       return *this;
@@ -802,5 +802,5 @@
     /// will not be constructed.
     DigraphReader& skipArcs() {
-      LEMON_ASSERT(!_skip_arcs, "Skip arcs already set"); 
+      LEMON_ASSERT(!_skip_arcs, "Skip arcs already set");
       _skip_arcs = true;
       return *this;
@@ -814,10 +814,10 @@
       std::string str;
       while(++line_num, std::getline(*_is, str)) {
-	line.clear(); line.str(str);
-	char c;
-	if (line >> std::ws >> c && c != '#') {
-	  line.putback(c);
-	  return true;
-	}
+        line.clear(); line.str(str);
+        char c;
+        if (line >> std::ws >> c && c != '#') {
+          line.putback(c);
+          return true;
+        }
       }
       return false;
@@ -827,9 +827,9 @@
       return static_cast<bool>(*_is);
     }
-    
+
     void skipSection() {
       char c;
       while (readSuccess() && line >> c && c != '@') {
-	readLine();
+        readLine();
       }
       line.putback(c);
@@ -843,87 +843,87 @@
       char c;
       if (!readLine() || !(line >> c) || c == '@') {
-	if (readSuccess() && line) line.putback(c);
-	if (!_node_maps.empty()) 
-	  throw DataFormatError("Cannot find map names");
-	return;
+        if (readSuccess() && line) line.putback(c);
+        if (!_node_maps.empty())
+          throw DataFormatError("Cannot find map names");
+        return;
       }
       line.putback(c);
 
       {
-	std::map<std::string, int> maps;
-	
-	std::string map;
-	int index = 0;
-	while (_reader_bits::readToken(line, map)) {
-	  if (maps.find(map) != maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Multiple occurence of node map: " << map;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  maps.insert(std::make_pair(map, index));
-	  ++index;
-	}
-	
-	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
-	  std::map<std::string, int>::iterator jt = 
-	    maps.find(_node_maps[i].first);
-	  if (jt == maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Map not found in file: " << _node_maps[i].first;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  map_index[i] = jt->second;
-	}
-
-	{
-	  std::map<std::string, int>::iterator jt = maps.find("label");
-	  if (jt != maps.end()) {
-	    label_index = jt->second;
-	  } else {
-	    label_index = -1;
-	  }
-	}
-	map_num = maps.size();
+        std::map<std::string, int> maps;
+
+        std::string map;
+        int index = 0;
+        while (_reader_bits::readToken(line, map)) {
+          if (maps.find(map) != maps.end()) {
+            std::ostringstream msg;
+            msg << "Multiple occurence of node map: " << map;
+            throw DataFormatError(msg.str().c_str());
+          }
+          maps.insert(std::make_pair(map, index));
+          ++index;
+        }
+
+        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
+          std::map<std::string, int>::iterator jt =
+            maps.find(_node_maps[i].first);
+          if (jt == maps.end()) {
+            std::ostringstream msg;
+            msg << "Map not found in file: " << _node_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
+          }
+          map_index[i] = jt->second;
+        }
+
+        {
+          std::map<std::string, int>::iterator jt = maps.find("label");
+          if (jt != maps.end()) {
+            label_index = jt->second;
+          } else {
+            label_index = -1;
+          }
+        }
+        map_num = maps.size();
       }
 
       while (readLine() && line >> c && c != '@') {
-	line.putback(c);
-
-	std::vector<std::string> tokens(map_num);
-	for (int i = 0; i < map_num; ++i) {
-	  if (!_reader_bits::readToken(line, tokens[i])) {
-	    std::ostringstream msg;
-	    msg << "Column not found (" << i + 1 << ")";
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	}
-	if (line >> std::ws >> c)
-	  throw DataFormatError("Extra character on the end of line");
-	
-	Node n;
-	if (!_use_nodes) {
-	  n = _digraph.addNode();
-	  if (label_index != -1)
-	    _node_index.insert(std::make_pair(tokens[label_index], n));
-	} else {
-	  if (label_index == -1) 
-	    throw DataFormatError("Label map not found in file");
-	  typename std::map<std::string, Node>::iterator it =
-	    _node_index.find(tokens[label_index]);
-	  if (it == _node_index.end()) {
-	    std::ostringstream msg;
-	    msg << "Node with label not found: " << tokens[label_index];
-	    throw DataFormatError(msg.str().c_str());	    
-	  }
-	  n = it->second;
-	}
-
-	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
-	  _node_maps[i].second->set(n, tokens[map_index[i]]);
-	}
+        line.putback(c);
+
+        std::vector<std::string> tokens(map_num);
+        for (int i = 0; i < map_num; ++i) {
+          if (!_reader_bits::readToken(line, tokens[i])) {
+            std::ostringstream msg;
+            msg << "Column not found (" << i + 1 << ")";
+            throw DataFormatError(msg.str().c_str());
+          }
+        }
+        if (line >> std::ws >> c)
+          throw DataFormatError("Extra character on the end of line");
+
+        Node n;
+        if (!_use_nodes) {
+          n = _digraph.addNode();
+          if (label_index != -1)
+            _node_index.insert(std::make_pair(tokens[label_index], n));
+        } else {
+          if (label_index == -1)
+            throw DataFormatError("Label map not found in file");
+          typename std::map<std::string, Node>::iterator it =
+            _node_index.find(tokens[label_index]);
+          if (it == _node_index.end()) {
+            std::ostringstream msg;
+            msg << "Node with label not found: " << tokens[label_index];
+            throw DataFormatError(msg.str().c_str());
+          }
+          n = it->second;
+        }
+
+        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
+          _node_maps[i].second->set(n, tokens[map_index[i]]);
+        }
 
       }
       if (readSuccess()) {
-	line.putback(c);
+        line.putback(c);
       }
     }
@@ -936,76 +936,76 @@
       char c;
       if (!readLine() || !(line >> c) || c == '@') {
-	if (readSuccess() && line) line.putback(c);
-	if (!_arc_maps.empty()) 
-	  throw DataFormatError("Cannot find map names");
-	return;
+        if (readSuccess() && line) line.putback(c);
+        if (!_arc_maps.empty())
+          throw DataFormatError("Cannot find map names");
+        return;
       }
       line.putback(c);
-      
+
       {
-	std::map<std::string, int> maps;
-	
-	std::string map;
-	int index = 0;
-	while (_reader_bits::readToken(line, map)) {
-	  if (maps.find(map) != maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Multiple occurence of arc map: " << map;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  maps.insert(std::make_pair(map, index));
-	  ++index;
-	}
-	
-	for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
-	  std::map<std::string, int>::iterator jt = 
-	    maps.find(_arc_maps[i].first);
-	  if (jt == maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Map not found in file: " << _arc_maps[i].first;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  map_index[i] = jt->second;
-	}
-
-	{
-	  std::map<std::string, int>::iterator jt = maps.find("label");
-	  if (jt != maps.end()) {
-	    label_index = jt->second;
-	  } else {
-	    label_index = -1;
-	  }
-	}
-	map_num = maps.size();
+        std::map<std::string, int> maps;
+
+        std::string map;
+        int index = 0;
+        while (_reader_bits::readToken(line, map)) {
+          if (maps.find(map) != maps.end()) {
+            std::ostringstream msg;
+            msg << "Multiple occurence of arc map: " << map;
+            throw DataFormatError(msg.str().c_str());
+          }
+          maps.insert(std::make_pair(map, index));
+          ++index;
+        }
+
+        for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
+          std::map<std::string, int>::iterator jt =
+            maps.find(_arc_maps[i].first);
+          if (jt == maps.end()) {
+            std::ostringstream msg;
+            msg << "Map not found in file: " << _arc_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
+          }
+          map_index[i] = jt->second;
+        }
+
+        {
+          std::map<std::string, int>::iterator jt = maps.find("label");
+          if (jt != maps.end()) {
+            label_index = jt->second;
+          } else {
+            label_index = -1;
+          }
+        }
+        map_num = maps.size();
       }
 
       while (readLine() && line >> c && c != '@') {
-	line.putback(c);
-
-	std::string source_token;
-	std::string target_token;
-
-	if (!_reader_bits::readToken(line, source_token))
-	  throw DataFormatError("Source not found");
-
-	if (!_reader_bits::readToken(line, target_token))
-	  throw DataFormatError("Target not found");
-	
-	std::vector<std::string> tokens(map_num);
-	for (int i = 0; i < map_num; ++i) {
-	  if (!_reader_bits::readToken(line, tokens[i])) {
-	    std::ostringstream msg;
-	    msg << "Column not found (" << i + 1 << ")";
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	}
-	if (line >> std::ws >> c)
-	  throw DataFormatError("Extra character on the end of line");
-	
-	Arc a;
-	if (!_use_arcs) {
+        line.putback(c);
+
+        std::string source_token;
+        std::string target_token;
+
+        if (!_reader_bits::readToken(line, source_token))
+          throw DataFormatError("Source not found");
+
+        if (!_reader_bits::readToken(line, target_token))
+          throw DataFormatError("Target not found");
+
+        std::vector<std::string> tokens(map_num);
+        for (int i = 0; i < map_num; ++i) {
+          if (!_reader_bits::readToken(line, tokens[i])) {
+            std::ostringstream msg;
+            msg << "Column not found (" << i + 1 << ")";
+            throw DataFormatError(msg.str().c_str());
+          }
+        }
+        if (line >> std::ws >> c)
+          throw DataFormatError("Extra character on the end of line");
+
+        Arc a;
+        if (!_use_arcs) {
 
           typename NodeIndex::iterator it;
- 
+
           it = _node_index.find(source_token);
           if (it == _node_index.end()) {
@@ -1017,34 +1017,34 @@
 
           it = _node_index.find(target_token);
-          if (it == _node_index.end()) {       
-            std::ostringstream msg;            
+          if (it == _node_index.end()) {
+            std::ostringstream msg;
             msg << "Item not found: " << target_token;
             throw DataFormatError(msg.str().c_str());
-          }                                          
-          Node target = it->second;                            
-
-	  a = _digraph.addArc(source, target);
-	  if (label_index != -1) 
-	    _arc_index.insert(std::make_pair(tokens[label_index], a));
-	} else {
-	  if (label_index == -1) 
-	    throw DataFormatError("Label map not found in file");
-	  typename std::map<std::string, Arc>::iterator it =
-	    _arc_index.find(tokens[label_index]);
-	  if (it == _arc_index.end()) {
-	    std::ostringstream msg;
-	    msg << "Arc with label not found: " << tokens[label_index];
-	    throw DataFormatError(msg.str().c_str());	    
-	  }
-	  a = it->second;
-	}
-
-	for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
-	  _arc_maps[i].second->set(a, tokens[map_index[i]]);
-	}
+          }
+          Node target = it->second;
+
+          a = _digraph.addArc(source, target);
+          if (label_index != -1)
+            _arc_index.insert(std::make_pair(tokens[label_index], a));
+        } else {
+          if (label_index == -1)
+            throw DataFormatError("Label map not found in file");
+          typename std::map<std::string, Arc>::iterator it =
+            _arc_index.find(tokens[label_index]);
+          if (it == _arc_index.end()) {
+            std::ostringstream msg;
+            msg << "Arc with label not found: " << tokens[label_index];
+            throw DataFormatError(msg.str().c_str());
+          }
+          a = it->second;
+        }
+
+        for (int i = 0; i < static_cast<int>(_arc_maps.size()); ++i) {
+          _arc_maps[i].second->set(a, tokens[map_index[i]]);
+        }
 
       }
       if (readSuccess()) {
-	line.putback(c);
+        line.putback(c);
       }
     }
@@ -1056,43 +1056,43 @@
       char c;
       while (readLine() && line >> c && c != '@') {
-	line.putback(c);
-	
-	std::string attr, token;
-	if (!_reader_bits::readToken(line, attr))
-	  throw DataFormatError("Attribute name not found");
-	if (!_reader_bits::readToken(line, token))
-	  throw DataFormatError("Attribute value not found");
-	if (line >> c)
-	  throw DataFormatError("Extra character on the end of line");	  
-
-	{
-	  std::set<std::string>::iterator it = read_attr.find(attr);
-	  if (it != read_attr.end()) {
-	    std::ostringstream msg;
-	    msg << "Multiple occurence of attribute " << attr;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  read_attr.insert(attr);
-	}
-	
-	{
-	  typename Attributes::iterator it = _attributes.lower_bound(attr);
-	  while (it != _attributes.end() && it->first == attr) {
-	    it->second->set(token);
-	    ++it;
-	  }
-	}
+        line.putback(c);
+
+        std::string attr, token;
+        if (!_reader_bits::readToken(line, attr))
+          throw DataFormatError("Attribute name not found");
+        if (!_reader_bits::readToken(line, token))
+          throw DataFormatError("Attribute value not found");
+        if (line >> c)
+          throw DataFormatError("Extra character on the end of line");
+
+        {
+          std::set<std::string>::iterator it = read_attr.find(attr);
+          if (it != read_attr.end()) {
+            std::ostringstream msg;
+            msg << "Multiple occurence of attribute " << attr;
+            throw DataFormatError(msg.str().c_str());
+          }
+          read_attr.insert(attr);
+        }
+
+        {
+          typename Attributes::iterator it = _attributes.lower_bound(attr);
+          while (it != _attributes.end() && it->first == attr) {
+            it->second->set(token);
+            ++it;
+          }
+        }
 
       }
       if (readSuccess()) {
-	line.putback(c);
+        line.putback(c);
       }
       for (typename Attributes::iterator it = _attributes.begin();
-	   it != _attributes.end(); ++it) {
-	if (read_attr.find(it->first) == read_attr.end()) {
-	  std::ostringstream msg;
-	  msg << "Attribute not found in file: " << it->first;
-	  throw DataFormatError(msg.str().c_str());
-	}	
+           it != _attributes.end(); ++it) {
+        if (read_attr.find(it->first) == read_attr.end()) {
+          std::ostringstream msg;
+          msg << "Attribute not found in file: " << it->first;
+          throw DataFormatError(msg.str().c_str());
+        }
       }
     }
@@ -1100,5 +1100,5 @@
   public:
 
-    /// \name Execution of the reader    
+    /// \name Execution of the reader
     /// @{
 
@@ -1109,62 +1109,62 @@
       LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
       if (!*_is) {
-	throw DataFormatError("Cannot find file");
-      }
-      
+        throw DataFormatError("Cannot find file");
+      }
+
       bool nodes_done = _skip_nodes;
       bool arcs_done = _skip_arcs;
       bool attributes_done = false;
 
-      line_num = 0;      
+      line_num = 0;
       readLine();
       skipSection();
 
       while (readSuccess()) {
-	try {
-	  char c;
-	  std::string section, caption;
-	  line >> c;
-	  _reader_bits::readToken(line, section);
-	  _reader_bits::readToken(line, caption);
-
-	  if (line >> c) 
-	    throw DataFormatError("Extra character on the end of line");
-
-	  if (section == "nodes" && !nodes_done) {
-	    if (_nodes_caption.empty() || _nodes_caption == caption) {
-	      readNodes();
-	      nodes_done = true;
-	    }
-	  } else if ((section == "arcs" || section == "edges") && 
-		     !arcs_done) {
-	    if (_arcs_caption.empty() || _arcs_caption == caption) {
-	      readArcs();
-	      arcs_done = true;
-	    }
-	  } else if (section == "attributes" && !attributes_done) {
-	    if (_attributes_caption.empty() || _attributes_caption == caption) {
-	      readAttributes();
-	      attributes_done = true;
-	    }
-	  } else {
-	    readLine();
-	    skipSection();
-	  }
-	} catch (DataFormatError& error) {
-	  error.line(line_num);
-	  throw;
-	}	
+        try {
+          char c;
+          std::string section, caption;
+          line >> c;
+          _reader_bits::readToken(line, section);
+          _reader_bits::readToken(line, caption);
+
+          if (line >> c)
+            throw DataFormatError("Extra character on the end of line");
+
+          if (section == "nodes" && !nodes_done) {
+            if (_nodes_caption.empty() || _nodes_caption == caption) {
+              readNodes();
+              nodes_done = true;
+            }
+          } else if ((section == "arcs" || section == "edges") &&
+                     !arcs_done) {
+            if (_arcs_caption.empty() || _arcs_caption == caption) {
+              readArcs();
+              arcs_done = true;
+            }
+          } else if (section == "attributes" && !attributes_done) {
+            if (_attributes_caption.empty() || _attributes_caption == caption) {
+              readAttributes();
+              attributes_done = true;
+            }
+          } else {
+            readLine();
+            skipSection();
+          }
+        } catch (DataFormatError& error) {
+          error.line(line_num);
+          throw;
+        }
       }
 
       if (!nodes_done) {
-	throw DataFormatError("Section @nodes not found");
+        throw DataFormatError("Section @nodes not found");
       }
 
       if (!arcs_done) {
-	throw DataFormatError("Section @arcs not found");
+        throw DataFormatError("Section @arcs not found");
       }
 
       if (!attributes_done && !_attributes.empty()) {
-	throw DataFormatError("Section @attributes not found");
+        throw DataFormatError("Section @attributes not found");
       }
 
@@ -1172,9 +1172,9 @@
 
     /// @}
-    
+
   };
 
   /// \brief Return a \ref DigraphReader class
-  /// 
+  ///
   /// This function just returns a \ref DigraphReader class.
   /// \relates DigraphReader
@@ -1186,10 +1186,10 @@
 
   /// \brief Return a \ref DigraphReader class
-  /// 
+  ///
   /// This function just returns a \ref DigraphReader class.
   /// \relates DigraphReader
   template <typename Digraph>
-  DigraphReader<Digraph> digraphReader(const std::string& fn, 
-				       Digraph& digraph) {
+  DigraphReader<Digraph> digraphReader(const std::string& fn,
+                                       Digraph& digraph) {
     DigraphReader<Digraph> tmp(fn, digraph);
     return tmp;
@@ -1197,5 +1197,5 @@
 
   /// \brief Return a \ref DigraphReader class
-  /// 
+  ///
   /// This function just returns a \ref DigraphReader class.
   /// \relates DigraphReader
@@ -1210,14 +1210,14 @@
 
   template <typename Graph>
-  GraphReader<Graph> graphReader(std::istream& is, Graph& graph);    
+  GraphReader<Graph> graphReader(std::istream& is, Graph& graph);
 
   template <typename Graph>
-  GraphReader<Graph> graphReader(const std::string& fn, Graph& graph);   
+  GraphReader<Graph> graphReader(const std::string& fn, Graph& graph);
 
   template <typename Graph>
-  GraphReader<Graph> graphReader(const char *fn, Graph& graph);    
+  GraphReader<Graph> graphReader(const char *fn, Graph& graph);
 
   /// \ingroup lemon_io
-  ///  
+  ///
   /// \brief \ref lgf-format "LGF" reader for undirected graphs
   ///
@@ -1239,5 +1239,5 @@
     typedef _Graph Graph;
     TEMPLATE_GRAPH_TYPEDEFS(Graph);
-    
+
   private:
 
@@ -1255,8 +1255,8 @@
     typedef std::map<std::string, Edge> EdgeIndex;
     EdgeIndex _edge_index;
-    
-    typedef std::vector<std::pair<std::string, 
-      _reader_bits::MapStorageBase<Node>*> > NodeMaps;    
-    NodeMaps _node_maps; 
+
+    typedef std::vector<std::pair<std::string,
+      _reader_bits::MapStorageBase<Node>*> > NodeMaps;
+    NodeMaps _node_maps;
 
     typedef std::vector<std::pair<std::string,
@@ -1264,5 +1264,5 @@
     EdgeMaps _edge_maps;
 
-    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*> 
+    typedef std::multimap<std::string, _reader_bits::ValueStorageBase*>
       Attributes;
     Attributes _attributes;
@@ -1283,8 +1283,8 @@
     /// Construct an undirected graph reader, which reads from the given
     /// input stream.
-    GraphReader(std::istream& is, Graph& graph) 
+    GraphReader(std::istream& is, Graph& graph)
       : _is(&is), local_is(false), _graph(graph),
-	_use_nodes(false), _use_edges(false),
-	_skip_nodes(false), _skip_edges(false) {}
+        _use_nodes(false), _use_edges(false),
+        _skip_nodes(false), _skip_edges(false) {}
 
     /// \brief Constructor
@@ -1292,37 +1292,37 @@
     /// Construct an undirected graph reader, which reads from the given
     /// file.
-    GraphReader(const std::string& fn, Graph& graph) 
+    GraphReader(const std::string& fn, Graph& graph)
       : _is(new std::ifstream(fn.c_str())), local_is(true), _graph(graph),
-    	_use_nodes(false), _use_edges(false),
-	_skip_nodes(false), _skip_edges(false) {}
-    
+            _use_nodes(false), _use_edges(false),
+        _skip_nodes(false), _skip_edges(false) {}
+
     /// \brief Constructor
     ///
     /// Construct an undirected graph reader, which reads from the given
     /// file.
-    GraphReader(const char* fn, Graph& graph) 
+    GraphReader(const char* fn, Graph& graph)
       : _is(new std::ifstream(fn)), local_is(true), _graph(graph),
-    	_use_nodes(false), _use_edges(false),
-	_skip_nodes(false), _skip_edges(false) {}
+            _use_nodes(false), _use_edges(false),
+        _skip_nodes(false), _skip_edges(false) {}
 
     /// \brief Destructor
     ~GraphReader() {
-      for (typename NodeMaps::iterator it = _node_maps.begin(); 
-	   it != _node_maps.end(); ++it) {
-	delete it->second;
-      }
-
-      for (typename EdgeMaps::iterator it = _edge_maps.begin(); 
-	   it != _edge_maps.end(); ++it) {
-	delete it->second;
-      }
-
-      for (typename Attributes::iterator it = _attributes.begin(); 
-	   it != _attributes.end(); ++it) {
-	delete it->second;
+      for (typename NodeMaps::iterator it = _node_maps.begin();
+           it != _node_maps.end(); ++it) {
+        delete it->second;
+      }
+
+      for (typename EdgeMaps::iterator it = _edge_maps.begin();
+           it != _edge_maps.end(); ++it) {
+        delete it->second;
+      }
+
+      for (typename Attributes::iterator it = _attributes.begin();
+           it != _attributes.end(); ++it) {
+        delete it->second;
       }
 
       if (local_is) {
-	delete _is;
+        delete _is;
       }
 
@@ -1330,17 +1330,17 @@
 
   private:
-    friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph);    
-    friend GraphReader<Graph> graphReader<>(const std::string& fn, 
-					    Graph& graph);   
-    friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph);    
-
-    GraphReader(GraphReader& other) 
+    friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph);
+    friend GraphReader<Graph> graphReader<>(const std::string& fn,
+                                            Graph& graph);
+    friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph);
+
+    GraphReader(GraphReader& other)
       : _is(other._is), local_is(other.local_is), _graph(other._graph),
-	_use_nodes(other._use_nodes), _use_edges(other._use_edges),
-	_skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
+        _use_nodes(other._use_nodes), _use_edges(other._use_edges),
+        _skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
 
       other._is = 0;
       other.local_is = false;
-      
+
       _node_index.swap(other._node_index);
       _edge_index.swap(other._edge_index);
@@ -1362,5 +1362,5 @@
     /// \name Reading rules
     /// @{
-    
+
     /// \brief Node map reading rule
     ///
@@ -1369,6 +1369,6 @@
     GraphReader& nodeMap(const std::string& caption, Map& map) {
       checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Node>* storage = 
-	new _reader_bits::MapStorage<Node, Map>(map);
+      _reader_bits::MapStorageBase<Node>* storage =
+        new _reader_bits::MapStorage<Node, Map>(map);
       _node_maps.push_back(std::make_pair(caption, storage));
       return *this;
@@ -1380,9 +1380,9 @@
     /// reader.
     template <typename Map, typename Converter>
-    GraphReader& nodeMap(const std::string& caption, Map& map, 
-			   const Converter& converter = Converter()) {
+    GraphReader& nodeMap(const std::string& caption, Map& map,
+                           const Converter& converter = Converter()) {
       checkConcept<concepts::WriteMap<Node, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Node>* storage = 
-	new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
+      _reader_bits::MapStorageBase<Node>* storage =
+        new _reader_bits::MapStorage<Node, Map, Converter>(map, converter);
       _node_maps.push_back(std::make_pair(caption, storage));
       return *this;
@@ -1395,6 +1395,6 @@
     GraphReader& edgeMap(const std::string& caption, Map& map) {
       checkConcept<concepts::WriteMap<Edge, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Edge>* storage = 
-	new _reader_bits::MapStorage<Edge, Map>(map);
+      _reader_bits::MapStorageBase<Edge>* storage =
+        new _reader_bits::MapStorage<Edge, Map>(map);
       _edge_maps.push_back(std::make_pair(caption, storage));
       return *this;
@@ -1406,9 +1406,9 @@
     /// reader.
     template <typename Map, typename Converter>
-    GraphReader& edgeMap(const std::string& caption, Map& map, 
-			  const Converter& converter = Converter()) {
+    GraphReader& edgeMap(const std::string& caption, Map& map,
+                          const Converter& converter = Converter()) {
       checkConcept<concepts::WriteMap<Edge, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Edge>* storage = 
-	new _reader_bits::MapStorage<Edge, Map, Converter>(map, converter);
+      _reader_bits::MapStorageBase<Edge>* storage =
+        new _reader_bits::MapStorage<Edge, Map, Converter>(map, converter);
       _edge_maps.push_back(std::make_pair(caption, storage));
       return *this;
@@ -1421,9 +1421,9 @@
     GraphReader& arcMap(const std::string& caption, Map& map) {
       checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Edge>* forward_storage = 
-	new _reader_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
+      _reader_bits::MapStorageBase<Edge>* forward_storage =
+        new _reader_bits::GraphArcMapStorage<Graph, true, Map>(_graph, map);
       _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
-      _reader_bits::MapStorageBase<Edge>* backward_storage = 
-	new _reader_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
+      _reader_bits::MapStorageBase<Edge>* backward_storage =
+        new _reader_bits::GraphArcMapStorage<Graph, false, Map>(_graph, map);
       _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
       return *this;
@@ -1435,14 +1435,14 @@
     /// reader.
     template <typename Map, typename Converter>
-    GraphReader& arcMap(const std::string& caption, Map& map, 
-			  const Converter& converter = Converter()) {
+    GraphReader& arcMap(const std::string& caption, Map& map,
+                          const Converter& converter = Converter()) {
       checkConcept<concepts::WriteMap<Arc, typename Map::Value>, Map>();
-      _reader_bits::MapStorageBase<Edge>* forward_storage = 
-	new _reader_bits::GraphArcMapStorage<Graph, true, Map, Converter>
-	(_graph, map, converter);
+      _reader_bits::MapStorageBase<Edge>* forward_storage =
+        new _reader_bits::GraphArcMapStorage<Graph, true, Map, Converter>
+        (_graph, map, converter);
       _edge_maps.push_back(std::make_pair('+' + caption, forward_storage));
-      _reader_bits::MapStorageBase<Edge>* backward_storage = 
-	new _reader_bits::GraphArcMapStorage<Graph, false, Map, Converter>
-	(_graph, map, converter);
+      _reader_bits::MapStorageBase<Edge>* backward_storage =
+        new _reader_bits::GraphArcMapStorage<Graph, false, Map, Converter>
+        (_graph, map, converter);
       _edge_maps.push_back(std::make_pair('-' + caption, backward_storage));
       return *this;
@@ -1454,6 +1454,6 @@
     template <typename Value>
     GraphReader& attribute(const std::string& caption, Value& value) {
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Value>(value);
+      _reader_bits::ValueStorageBase* storage =
+        new _reader_bits::ValueStorage<Value>(value);
       _attributes.insert(std::make_pair(caption, storage));
       return *this;
@@ -1465,8 +1465,8 @@
     /// reader.
     template <typename Value, typename Converter>
-    GraphReader& attribute(const std::string& caption, Value& value, 
-			     const Converter& converter = Converter()) {
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Value, Converter>(value, converter);
+    GraphReader& attribute(const std::string& caption, Value& value,
+                             const Converter& converter = Converter()) {
+      _reader_bits::ValueStorageBase* storage =
+        new _reader_bits::ValueStorage<Value, Converter>(value, converter);
       _attributes.insert(std::make_pair(caption, storage));
       return *this;
@@ -1479,6 +1479,6 @@
       typedef _reader_bits::MapLookUpConverter<Node> Converter;
       Converter converter(_node_index);
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Node, Converter>(node, converter);
+      _reader_bits::ValueStorageBase* storage =
+        new _reader_bits::ValueStorage<Node, Converter>(node, converter);
       _attributes.insert(std::make_pair(caption, storage));
       return *this;
@@ -1491,6 +1491,6 @@
       typedef _reader_bits::MapLookUpConverter<Edge> Converter;
       Converter converter(_edge_index);
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Edge, Converter>(edge, converter);
+      _reader_bits::ValueStorageBase* storage =
+        new _reader_bits::ValueStorage<Edge, Converter>(edge, converter);
       _attributes.insert(std::make_pair(caption, storage));
       return *this;
@@ -1503,6 +1503,6 @@
       typedef _reader_bits::GraphArcLookUpConverter<Graph> Converter;
       Converter converter(_graph, _edge_index);
-      _reader_bits::ValueStorageBase* storage = 
-	new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
+      _reader_bits::ValueStorageBase* storage =
+        new _reader_bits::ValueStorage<Arc, Converter>(arc, converter);
       _attributes.insert(std::make_pair(caption, storage));
       return *this;
@@ -1550,9 +1550,9 @@
     GraphReader& useNodes(const Map& map) {
       checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
-      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
+      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
       _use_nodes = true;
       _writer_bits::DefaultConverter<typename Map::Value> converter;
       for (NodeIt n(_graph); n != INVALID; ++n) {
-	_node_index.insert(std::make_pair(converter(map[n]), n));
+        _node_index.insert(std::make_pair(converter(map[n]), n));
       }
       return *this;
@@ -1565,11 +1565,11 @@
     /// \c std::string.
     template <typename Map, typename Converter>
-    GraphReader& useNodes(const Map& map, 
-			    const Converter& converter = Converter()) {
+    GraphReader& useNodes(const Map& map,
+                            const Converter& converter = Converter()) {
       checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
-      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member"); 
+      LEMON_ASSERT(!_use_nodes, "Multiple usage of useNodes() member");
       _use_nodes = true;
       for (NodeIt n(_graph); n != INVALID; ++n) {
-	_node_index.insert(std::make_pair(converter(map[n]), n));
+        _node_index.insert(std::make_pair(converter(map[n]), n));
       }
       return *this;
@@ -1587,5 +1587,5 @@
       _writer_bits::DefaultConverter<typename Map::Value> converter;
       for (EdgeIt a(_graph); a != INVALID; ++a) {
-	_edge_index.insert(std::make_pair(converter(map[a]), a));
+        _edge_index.insert(std::make_pair(converter(map[a]), a));
       }
       return *this;
@@ -1598,11 +1598,11 @@
     /// \c std::string.
     template <typename Map, typename Converter>
-    GraphReader& useEdges(const Map& map, 
-			    const Converter& converter = Converter()) {
+    GraphReader& useEdges(const Map& map,
+                            const Converter& converter = Converter()) {
       checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
-      LEMON_ASSERT(!_use_edges, "Multiple usage of useEdges() member"); 
+      LEMON_ASSERT(!_use_edges, "Multiple usage of useEdges() member");
       _use_edges = true;
       for (EdgeIt a(_graph); a != INVALID; ++a) {
-	_edge_index.insert(std::make_pair(converter(map[a]), a));
+        _edge_index.insert(std::make_pair(converter(map[a]), a));
       }
       return *this;
@@ -1619,5 +1619,5 @@
     /// \c useNodes() should be used to specify the label of the nodes.
     GraphReader& skipNodes() {
-      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set"); 
+      LEMON_ASSERT(!_skip_nodes, "Skip nodes already set");
       _skip_nodes = true;
       return *this;
@@ -1630,5 +1630,5 @@
     /// will not be constructed.
     GraphReader& skipEdges() {
-      LEMON_ASSERT(!_skip_edges, "Skip edges already set"); 
+      LEMON_ASSERT(!_skip_edges, "Skip edges already set");
       _skip_edges = true;
       return *this;
@@ -1642,10 +1642,10 @@
       std::string str;
       while(++line_num, std::getline(*_is, str)) {
-	line.clear(); line.str(str);
-	char c;
-	if (line >> std::ws >> c && c != '#') {
-	  line.putback(c);
-	  return true;
-	}
+        line.clear(); line.str(str);
+        char c;
+        if (line >> std::ws >> c && c != '#') {
+          line.putback(c);
+          return true;
+        }
       }
       return false;
@@ -1655,9 +1655,9 @@
       return static_cast<bool>(*_is);
     }
-    
+
     void skipSection() {
       char c;
       while (readSuccess() && line >> c && c != '@') {
-	readLine();
+        readLine();
       }
       line.putback(c);
@@ -1671,87 +1671,87 @@
       char c;
       if (!readLine() || !(line >> c) || c == '@') {
-	if (readSuccess() && line) line.putback(c);
-	if (!_node_maps.empty()) 
-	  throw DataFormatError("Cannot find map names");
-	return;
+        if (readSuccess() && line) line.putback(c);
+        if (!_node_maps.empty())
+          throw DataFormatError("Cannot find map names");
+        return;
       }
       line.putback(c);
-      
+
       {
-	std::map<std::string, int> maps;
-	
-	std::string map;
-	int index = 0;
-	while (_reader_bits::readToken(line, map)) {
-	  if (maps.find(map) != maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Multiple occurence of node map: " << map;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  maps.insert(std::make_pair(map, index));
-	  ++index;
-	}
-	
-	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
-	  std::map<std::string, int>::iterator jt = 
-	    maps.find(_node_maps[i].first);
-	  if (jt == maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Map not found in file: " << _node_maps[i].first;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  map_index[i] = jt->second;
-	}
-
-	{
-	  std::map<std::string, int>::iterator jt = maps.find("label");
-	  if (jt != maps.end()) {
-	    label_index = jt->second;
-	  } else {
-	    label_index = -1;
-	  }
-	}
-	map_num = maps.size();
+        std::map<std::string, int> maps;
+
+        std::string map;
+        int index = 0;
+        while (_reader_bits::readToken(line, map)) {
+          if (maps.find(map) != maps.end()) {
+            std::ostringstream msg;
+            msg << "Multiple occurence of node map: " << map;
+            throw DataFormatError(msg.str().c_str());
+          }
+          maps.insert(std::make_pair(map, index));
+          ++index;
+        }
+
+        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
+          std::map<std::string, int>::iterator jt =
+            maps.find(_node_maps[i].first);
+          if (jt == maps.end()) {
+            std::ostringstream msg;
+            msg << "Map not found in file: " << _node_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
+          }
+          map_index[i] = jt->second;
+        }
+
+        {
+          std::map<std::string, int>::iterator jt = maps.find("label");
+          if (jt != maps.end()) {
+            label_index = jt->second;
+          } else {
+            label_index = -1;
+          }
+        }
+        map_num = maps.size();
       }
 
       while (readLine() && line >> c && c != '@') {
-	line.putback(c);
-
-	std::vector<std::string> tokens(map_num);
-	for (int i = 0; i < map_num; ++i) {
-	  if (!_reader_bits::readToken(line, tokens[i])) {
-	    std::ostringstream msg;
-	    msg << "Column not found (" << i + 1 << ")";
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	}
-	if (line >> std::ws >> c)
-	  throw DataFormatError("Extra character on the end of line");
-	
-	Node n;
-	if (!_use_nodes) {
-	  n = _graph.addNode();
-	  if (label_index != -1) 
-	    _node_index.insert(std::make_pair(tokens[label_index], n));
-	} else {
-	  if (label_index == -1) 
-	    throw DataFormatError("Label map not found in file");
-	  typename std::map<std::string, Node>::iterator it =
-	    _node_index.find(tokens[label_index]);
-	  if (it == _node_index.end()) {
-	    std::ostringstream msg;
-	    msg << "Node with label not found: " << tokens[label_index];
-	    throw DataFormatError(msg.str().c_str());	    
-	  }
-	  n = it->second;
-	}
-
-	for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
-	  _node_maps[i].second->set(n, tokens[map_index[i]]);
-	}
+        line.putback(c);
+
+        std::vector<std::string> tokens(map_num);
+        for (int i = 0; i < map_num; ++i) {
+          if (!_reader_bits::readToken(line, tokens[i])) {
+            std::ostringstream msg;
+            msg << "Column not found (" << i + 1 << ")";
+            throw DataFormatError(msg.str().c_str());
+          }
+        }
+        if (line >> std::ws >> c)
+          throw DataFormatError("Extra character on the end of line");
+
+        Node n;
+        if (!_use_nodes) {
+          n = _graph.addNode();
+          if (label_index != -1)
+            _node_index.insert(std::make_pair(tokens[label_index], n));
+        } else {
+          if (label_index == -1)
+            throw DataFormatError("Label map not found in file");
+          typename std::map<std::string, Node>::iterator it =
+            _node_index.find(tokens[label_index]);
+          if (it == _node_index.end()) {
+            std::ostringstream msg;
+            msg << "Node with label not found: " << tokens[label_index];
+            throw DataFormatError(msg.str().c_str());
+          }
+          n = it->second;
+        }
+
+        for (int i = 0; i < static_cast<int>(_node_maps.size()); ++i) {
+          _node_maps[i].second->set(n, tokens[map_index[i]]);
+        }
 
       }
       if (readSuccess()) {
-	line.putback(c);
+        line.putback(c);
       }
     }
@@ -1764,76 +1764,76 @@
       char c;
       if (!readLine() || !(line >> c) || c == '@') {
-	if (readSuccess() && line) line.putback(c);
-	if (!_edge_maps.empty()) 
-	  throw DataFormatError("Cannot find map names");
-	return;
+        if (readSuccess() && line) line.putback(c);
+        if (!_edge_maps.empty())
+          throw DataFormatError("Cannot find map names");
+        return;
       }
       line.putback(c);
-      
+
       {
-	std::map<std::string, int> maps;
-	
-	std::string map;
-	int index = 0;
-	while (_reader_bits::readToken(line, map)) {
-	  if (maps.find(map) != maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Multiple occurence of edge map: " << map;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  maps.insert(std::make_pair(map, index));
-	  ++index;
-	}
-	
-	for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
-	  std::map<std::string, int>::iterator jt = 
-	    maps.find(_edge_maps[i].first);
-	  if (jt == maps.end()) {
-	    std::ostringstream msg;
-	    msg << "Map not found in file: " << _edge_maps[i].first;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  map_index[i] = jt->second;
-	}
-
-	{
-	  std::map<std::string, int>::iterator jt = maps.find("label");
-	  if (jt != maps.end()) {
-	    label_index = jt->second;
-	  } else {
-	    label_index = -1;
-	  }
-	}
-	map_num = maps.size();
+        std::map<std::string, int> maps;
+
+        std::string map;
+        int index = 0;
+        while (_reader_bits::readToken(line, map)) {
+          if (maps.find(map) != maps.end()) {
+            std::ostringstream msg;
+            msg << "Multiple occurence of edge map: " << map;
+            throw DataFormatError(msg.str().c_str());
+          }
+          maps.insert(std::make_pair(map, index));
+          ++index;
+        }
+
+        for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
+          std::map<std::string, int>::iterator jt =
+            maps.find(_edge_maps[i].first);
+          if (jt == maps.end()) {
+            std::ostringstream msg;
+            msg << "Map not found in file: " << _edge_maps[i].first;
+            throw DataFormatError(msg.str().c_str());
+          }
+          map_index[i] = jt->second;
+        }
+
+        {
+          std::map<std::string, int>::iterator jt = maps.find("label");
+          if (jt != maps.end()) {
+            label_index = jt->second;
+          } else {
+            label_index = -1;
+          }
+        }
+        map_num = maps.size();
       }
 
       while (readLine() && line >> c && c != '@') {
-	line.putback(c);
-
-	std::string source_token;
-	std::string target_token;
-
-	if (!_reader_bits::readToken(line, source_token))
-	  throw DataFormatError("Node u not found");
-
-	if (!_reader_bits::readToken(line, target_token))
-	  throw DataFormatError("Node v not found");
-	
-	std::vector<std::string> tokens(map_num);
-	for (int i = 0; i < map_num; ++i) {
-	  if (!_reader_bits::readToken(line, tokens[i])) {
-	    std::ostringstream msg;
-	    msg << "Column not found (" << i + 1 << ")";
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	}
-	if (line >> std::ws >> c)
-	  throw DataFormatError("Extra character on the end of line");
-	
-	Edge e;
-	if (!_use_edges) {
+        line.putback(c);
+
+        std::string source_token;
+        std::string target_token;
+
+        if (!_reader_bits::readToken(line, source_token))
+          throw DataFormatError("Node u not found");
+
+        if (!_reader_bits::readToken(line, target_token))
+          throw DataFormatError("Node v not found");
+
+        std::vector<std::string> tokens(map_num);
+        for (int i = 0; i < map_num; ++i) {
+          if (!_reader_bits::readToken(line, tokens[i])) {
+            std::ostringstream msg;
+            msg << "Column not found (" << i + 1 << ")";
+            throw DataFormatError(msg.str().c_str());
+          }
+        }
+        if (line >> std::ws >> c)
+          throw DataFormatError("Extra character on the end of line");
+
+        Edge e;
+        if (!_use_edges) {
 
           typename NodeIndex::iterator it;
- 
+
           it = _node_index.find(source_token);
           if (it == _node_index.end()) {
@@ -1845,34 +1845,34 @@
 
           it = _node_index.find(target_token);
-          if (it == _node_index.end()) {       
-            std::ostringstream msg;            
+          if (it == _node_index.end()) {
+            std::ostringstream msg;
             msg << "Item not found: " << target_token;
             throw DataFormatError(msg.str().c_str());
-          }                                          
-          Node target = it->second;                            
-
-	  e = _graph.addEdge(source, target);
-	  if (label_index != -1) 
-	    _edge_index.insert(std::make_pair(tokens[label_index], e));
-	} else {
-	  if (label_index == -1) 
-	    throw DataFormatError("Label map not found in file");
-	  typename std::map<std::string, Edge>::iterator it =
-	    _edge_index.find(tokens[label_index]);
-	  if (it == _edge_index.end()) {
-	    std::ostringstream msg;
-	    msg << "Edge with label not found: " << tokens[label_index];
-	    throw DataFormatError(msg.str().c_str());	    
-	  }
-	  e = it->second;
-	}
-
-	for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
-	  _edge_maps[i].second->set(e, tokens[map_index[i]]);
-	}
+          }
+          Node target = it->second;
+
+          e = _graph.addEdge(source, target);
+          if (label_index != -1)
+            _edge_index.insert(std::make_pair(tokens[label_index], e));
+        } else {
+          if (label_index == -1)
+            throw DataFormatError("Label map not found in file");
+          typename std::map<std::string, Edge>::iterator it =
+            _edge_index.find(tokens[label_index]);
+          if (it == _edge_index.end()) {
+            std::ostringstream msg;
+            msg << "Edge with label not found: " << tokens[label_index];
+            throw DataFormatError(msg.str().c_str());
+          }
+          e = it->second;
+        }
+
+        for (int i = 0; i < static_cast<int>(_edge_maps.size()); ++i) {
+          _edge_maps[i].second->set(e, tokens[map_index[i]]);
+        }
 
       }
       if (readSuccess()) {
-	line.putback(c);
+        line.putback(c);
       }
     }
@@ -1884,43 +1884,43 @@
       char c;
       while (readLine() && line >> c && c != '@') {
-	line.putback(c);
-	
-	std::string attr, token;
-	if (!_reader_bits::readToken(line, attr))
-	  throw DataFormatError("Attribute name not found");
-	if (!_reader_bits::readToken(line, token))
-	  throw DataFormatError("Attribute value not found");
-	if (line >> c)
-	  throw DataFormatError("Extra character on the end of line");	  
-
-	{
-	  std::set<std::string>::iterator it = read_attr.find(attr);
-	  if (it != read_attr.end()) {
-	    std::ostringstream msg;
-	    msg << "Multiple occurence of attribute " << attr;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  read_attr.insert(attr);
-	}
-	
-	{
-	  typename Attributes::iterator it = _attributes.lower_bound(attr);
-	  while (it != _attributes.end() && it->first == attr) {
-	    it->second->set(token);
-	    ++it;
-	  }
-	}
+        line.putback(c);
+
+        std::string attr, token;
+        if (!_reader_bits::readToken(line, attr))
+          throw DataFormatError("Attribute name not found");
+        if (!_reader_bits::readToken(line, token))
+          throw DataFormatError("Attribute value not found");
+        if (line >> c)
+          throw DataFormatError("Extra character on the end of line");
+
+        {
+          std::set<std::string>::iterator it = read_attr.find(attr);
+          if (it != read_attr.end()) {
+            std::ostringstream msg;
+            msg << "Multiple occurence of attribute " << attr;
+            throw DataFormatError(msg.str().c_str());
+          }
+          read_attr.insert(attr);
+        }
+
+        {
+          typename Attributes::iterator it = _attributes.lower_bound(attr);
+          while (it != _attributes.end() && it->first == attr) {
+            it->second->set(token);
+            ++it;
+          }
+        }
 
       }
       if (readSuccess()) {
-	line.putback(c);
+        line.putback(c);
       }
       for (typename Attributes::iterator it = _attributes.begin();
-	   it != _attributes.end(); ++it) {
-	if (read_attr.find(it->first) == read_attr.end()) {
-	  std::ostringstream msg;
-	  msg << "Attribute not found in file: " << it->first;
-	  throw DataFormatError(msg.str().c_str());
-	}	
+           it != _attributes.end(); ++it) {
+        if (read_attr.find(it->first) == read_attr.end()) {
+          std::ostringstream msg;
+          msg << "Attribute not found in file: " << it->first;
+          throw DataFormatError(msg.str().c_str());
+        }
       }
     }
@@ -1928,5 +1928,5 @@
   public:
 
-    /// \name Execution of the reader    
+    /// \name Execution of the reader
     /// @{
 
@@ -1935,62 +1935,62 @@
     /// This function starts the batch processing
     void run() {
-      
+
       LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
-      
+
       bool nodes_done = _skip_nodes;
       bool edges_done = _skip_edges;
       bool attributes_done = false;
 
-      line_num = 0;      
+      line_num = 0;
       readLine();
       skipSection();
 
       while (readSuccess()) {
-	try {
-	  char c;
-	  std::string section, caption;
-	  line >> c;
-	  _reader_bits::readToken(line, section);
-	  _reader_bits::readToken(line, caption);
-
-	  if (line >> c) 
-	    throw DataFormatError("Extra character on the end of line");
-
-	  if (section == "nodes" && !nodes_done) {
-	    if (_nodes_caption.empty() || _nodes_caption == caption) {
-	      readNodes();
-	      nodes_done = true;
-	    }
-	  } else if ((section == "edges" || section == "arcs") && 
-		     !edges_done) {
-	    if (_edges_caption.empty() || _edges_caption == caption) {
-	      readEdges();
-	      edges_done = true;
-	    }
-	  } else if (section == "attributes" && !attributes_done) {
-	    if (_attributes_caption.empty() || _attributes_caption == caption) {
-	      readAttributes();
-	      attributes_done = true;
-	    }
-	  } else {
-	    readLine();
-	    skipSection();
-	  }
-	} catch (DataFormatError& error) {
-	  error.line(line_num);
-	  throw;
-	}	
+        try {
+          char c;
+          std::string section, caption;
+          line >> c;
+          _reader_bits::readToken(line, section);
+          _reader_bits::readToken(line, caption);
+
+          if (line >> c)
+            throw DataFormatError("Extra character on the end of line");
+
+          if (section == "nodes" && !nodes_done) {
+            if (_nodes_caption.empty() || _nodes_caption == caption) {
+              readNodes();
+              nodes_done = true;
+            }
+          } else if ((section == "edges" || section == "arcs") &&
+                     !edges_done) {
+            if (_edges_caption.empty() || _edges_caption == caption) {
+              readEdges();
+              edges_done = true;
+            }
+          } else if (section == "attributes" && !attributes_done) {
+            if (_attributes_caption.empty() || _attributes_caption == caption) {
+              readAttributes();
+              attributes_done = true;
+            }
+          } else {
+            readLine();
+            skipSection();
+          }
+        } catch (DataFormatError& error) {
+          error.line(line_num);
+          throw;
+        }
       }
 
       if (!nodes_done) {
-	throw DataFormatError("Section @nodes not found");
+        throw DataFormatError("Section @nodes not found");
       }
 
       if (!edges_done) {
-	throw DataFormatError("Section @edges not found");
+        throw DataFormatError("Section @edges not found");
       }
 
       if (!attributes_done && !_attributes.empty()) {
-	throw DataFormatError("Section @attributes not found");
+        throw DataFormatError("Section @attributes not found");
       }
 
@@ -1998,9 +1998,9 @@
 
     /// @}
-    
+
   };
 
   /// \brief Return a \ref GraphReader class
-  /// 
+  ///
   /// This function just returns a \ref GraphReader class.
   /// \relates GraphReader
@@ -2012,10 +2012,10 @@
 
   /// \brief Return a \ref GraphReader class
-  /// 
+  ///
   /// This function just returns a \ref GraphReader class.
   /// \relates GraphReader
   template <typename Graph>
-  GraphReader<Graph> graphReader(const std::string& fn, 
-				       Graph& graph) {
+  GraphReader<Graph> graphReader(const std::string& fn,
+                                       Graph& graph) {
     GraphReader<Graph> tmp(fn, graph);
     return tmp;
@@ -2023,5 +2023,5 @@
 
   /// \brief Return a \ref GraphReader class
-  /// 
+  ///
   /// This function just returns a \ref GraphReader class.
   /// \relates GraphReader
@@ -2037,12 +2037,12 @@
   SectionReader sectionReader(const std::string& fn);
   SectionReader sectionReader(const char* fn);
-  
+
   /// \ingroup lemon_io
   ///
   /// \brief Section reader class
   ///
-  /// In the \ref lgf-format "LGF" file extra sections can be placed, 
+  /// In the \ref lgf-format "LGF" file extra sections can be placed,
   /// which contain any data in arbitrary format. Such sections can be
-  /// read with this class. A reading rule can be added to the class 
+  /// read with this class. A reading rule can be added to the class
   /// with two different functions. With the \c sectionLines() function a
   /// functor can process the section line-by-line, while with the \c
@@ -2051,5 +2051,5 @@
   class SectionReader {
   private:
-    
+
     std::istream* _is;
     bool local_is;
@@ -2067,5 +2067,5 @@
     /// Construct a section reader, which reads from the given input
     /// stream.
-    SectionReader(std::istream& is) 
+    SectionReader(std::istream& is)
       : _is(&is), local_is(false) {}
 
@@ -2073,22 +2073,22 @@
     ///
     /// Construct a section reader, which reads from the given file.
-    SectionReader(const std::string& fn) 
+    SectionReader(const std::string& fn)
       : _is(new std::ifstream(fn.c_str())), local_is(true) {}
-    
+
     /// \brief Constructor
     ///
     /// Construct a section reader, which reads from the given file.
-    SectionReader(const char* fn) 
+    SectionReader(const char* fn)
       : _is(new std::ifstream(fn)), local_is(true) {}
 
     /// \brief Destructor
     ~SectionReader() {
-      for (Sections::iterator it = _sections.begin(); 
-	   it != _sections.end(); ++it) {
-	delete it->second;
+      for (Sections::iterator it = _sections.begin();
+           it != _sections.end(); ++it) {
+        delete it->second;
       }
 
       if (local_is) {
-	delete _is;
+        delete _is;
       }
 
@@ -2101,13 +2101,13 @@
     friend SectionReader sectionReader(const char* fn);
 
-    SectionReader(SectionReader& other) 
+    SectionReader(SectionReader& other)
       : _is(other._is), local_is(other.local_is) {
 
       other._is = 0;
       other.local_is = false;
-      
+
       _sections.swap(other._sections);
     }
-    
+
     SectionReader& operator=(const SectionReader&);
 
@@ -2149,12 +2149,12 @@
     ///  // ...
     ///
-    ///  reader.sectionLines("numbers", NumberSection(vec));  
+    ///  reader.sectionLines("numbers", NumberSection(vec));
     ///\endcode
     template <typename Functor>
     SectionReader& sectionLines(const std::string& type, Functor functor) {
       LEMON_ASSERT(!type.empty(), "Type is empty.");
-      LEMON_ASSERT(_sections.find(type) == _sections.end(), 
-		   "Multiple reading of section.");
-      _sections.insert(std::make_pair(type, 
+      LEMON_ASSERT(_sections.find(type) == _sections.end(),
+                   "Multiple reading of section.");
+      _sections.insert(std::make_pair(type,
         new _reader_bits::LineSection<Functor>(functor)));
       return *this;
@@ -2172,11 +2172,11 @@
     SectionReader& sectionStream(const std::string& type, Functor functor) {
       LEMON_ASSERT(!type.empty(), "Type is empty.");
-      LEMON_ASSERT(_sections.find(type) == _sections.end(), 
-		   "Multiple reading of section.");
-      _sections.insert(std::make_pair(type, 
-	 new _reader_bits::StreamSection<Functor>(functor)));
-      return *this;
-    }    
-    
+      LEMON_ASSERT(_sections.find(type) == _sections.end(),
+                   "Multiple reading of section.");
+      _sections.insert(std::make_pair(type,
+         new _reader_bits::StreamSection<Functor>(functor)));
+      return *this;
+    }
+
     /// @}
 
@@ -2186,10 +2186,10 @@
       std::string str;
       while(++line_num, std::getline(*_is, str)) {
-	line.clear(); line.str(str);
-	char c;
-	if (line >> std::ws >> c && c != '#') {
-	  line.putback(c);
-	  return true;
-	}
+        line.clear(); line.str(str);
+        char c;
+        if (line >> std::ws >> c && c != '#') {
+          line.putback(c);
+          return true;
+        }
       }
       return false;
@@ -2199,9 +2199,9 @@
       return static_cast<bool>(*_is);
     }
-    
+
     void skipSection() {
       char c;
       while (readSuccess() && line >> c && c != '@') {
-	readLine();
+        readLine();
       }
       line.putback(c);
@@ -2211,5 +2211,5 @@
 
 
-    /// \name Execution of the reader    
+    /// \name Execution of the reader
     /// @{
 
@@ -2218,57 +2218,57 @@
     /// This function starts the batch processing.
     void run() {
-      
+
       LEMON_ASSERT(_is != 0, "This reader assigned to an other reader");
-      
+
       std::set<std::string> extra_sections;
 
-      line_num = 0;      
+      line_num = 0;
       readLine();
       skipSection();
 
       while (readSuccess()) {
-	try {
-	  char c;
-	  std::string section, caption;
-	  line >> c;
-	  _reader_bits::readToken(line, section);
-	  _reader_bits::readToken(line, caption);
-
-	  if (line >> c) 
-	    throw DataFormatError("Extra character on the end of line");
-
-	  if (extra_sections.find(section) != extra_sections.end()) {
-	    std::ostringstream msg;
-	    msg << "Multiple occurence of section " << section;
-	    throw DataFormatError(msg.str().c_str());
-	  }
-	  Sections::iterator it = _sections.find(section);
-	  if (it != _sections.end()) {
-	    extra_sections.insert(section);
-	    it->second->process(*_is, line_num);
-	  }
-	  readLine();
-	  skipSection();
-	} catch (DataFormatError& error) {
-	  error.line(line_num);
-	  throw;
-	}	
+        try {
+          char c;
+          std::string section, caption;
+          line >> c;
+          _reader_bits::readToken(line, section);
+          _reader_bits::readToken(line, caption);
+
+          if (line >> c)
+            throw DataFormatError("Extra character on the end of line");
+
+          if (extra_sections.find(section) != extra_sections.end()) {
+            std::ostringstream msg;
+            msg << "Multiple occurence of section " << section;
+            throw DataFormatError(msg.str().c_str());
+          }
+          Sections::iterator it = _sections.find(section);
+          if (it != _sections.end()) {
+            extra_sections.insert(section);
+            it->second->process(*_is, line_num);
+          }
+          readLine();
+          skipSection();
+        } catch (DataFormatError& error) {
+          error.line(line_num);
+          throw;
+        }
       }
       for (Sections::iterator it = _sections.begin();
-	   it != _sections.end(); ++it) {
-	if (extra_sections.find(it->first) == extra_sections.end()) {
-	  std::ostringstream os;
-	  os << "Cannot find section: " << it->first;
-	  throw DataFormatError(os.str().c_str());
-	}
+           it != _sections.end(); ++it) {
+        if (extra_sections.find(it->first) == extra_sections.end()) {
+          std::ostringstream os;
+          os << "Cannot find section: " << it->first;
+          throw DataFormatError(os.str().c_str());
+        }
       }
     }
 
     /// @}
-        
+
   };
 
   /// \brief Return a \ref SectionReader class
-  /// 
+  ///
   /// This function just returns a \ref SectionReader class.
   /// \relates SectionReader
@@ -2279,5 +2279,5 @@
 
   /// \brief Return a \ref SectionReader class
-  /// 
+  ///
   /// This function just returns a \ref SectionReader class.
   /// \relates SectionReader
@@ -2288,5 +2288,5 @@
 
   /// \brief Return a \ref SectionReader class
-  /// 
+  ///
   /// This function just returns a \ref SectionReader class.
   /// \relates SectionReader
@@ -2298,5 +2298,5 @@
   /// \ingroup lemon_io
   ///
-  /// \brief Reader for the contents of the \ref lgf-format "LGF" file 
+  /// \brief Reader for the contents of the \ref lgf-format "LGF" file
   ///
   /// This class can be used to read the sections, the map names and
@@ -2308,6 +2308,6 @@
   /// reading the graph.
   ///
-  ///\code 
-  /// LgfContents contents("graph.lgf"); 
+  ///\code
+  /// LgfContents contents("graph.lgf");
   /// contents.run();
   ///
@@ -2317,12 +2317,12 @@
   ///   return -1;
   /// }
-  /// std::cout << "The name of the default node section: " 
+  /// std::cout << "The name of the default node section: "
   ///           << contents.nodeSection(0) << std::endl;
-  /// std::cout << "The number of the arc maps: " 
+  /// std::cout << "The number of the arc maps: "
   ///           << contents.arcMaps(0).size() << std::endl;
-  /// std::cout << "The name of second arc map: " 
+  /// std::cout << "The name of second arc map: "
   ///           << contents.arcMaps(0)[1] << std::endl;
   ///\endcode
-  class LgfContents {    
+  class LgfContents {
   private:
 
@@ -2345,5 +2345,5 @@
     int line_num;
     std::istringstream line;
-    
+
   public:
 
@@ -2352,5 +2352,5 @@
     /// Construct an \e LGF contents reader, which reads from the given
     /// input stream.
-    LgfContents(std::istream& is) 
+    LgfContents(std::istream& is)
       : _is(&is), local_is(false) {}
 
@@ -2359,5 +2359,5 @@
     /// Construct an \e LGF contents reader, which reads from the given
     /// file.
-    LgfContents(const std::string& fn) 
+    LgfContents(const std::string& fn)
       : _is(new std::ifstream(fn.c_str())), local_is(true) {}
 
@@ -2368,5 +2368,5 @@
     LgfContents(const char* fn)
       : _is(new std::ifstream(fn)), local_is(true) {}
-    
+
     /// \brief Destructor
     ~LgfContents() {
@@ -2375,5 +2375,5 @@
 
   private:
-    
+
     LgfContents(const LgfContents&);
     LgfContents& operator=(const LgfContents&);
@@ -2392,7 +2392,7 @@
     }
 
-    /// \brief Returns the node section name at the given position. 
-    ///
-    /// Returns the node section name at the given position. 
+    /// \brief Returns the node section name at the given position.
+    ///
+    /// Returns the node section name at the given position.
     const std::string& nodeSection(int i) const {
       return _node_sections[i];
@@ -2408,5 +2408,5 @@
     /// @}
 
-    /// \name Arc/Edge sections 
+    /// \name Arc/Edge sections
     /// @{
 
@@ -2419,7 +2419,7 @@
     }
 
-    /// \brief Returns the arc/edge section name at the given position. 
-    ///
-    /// Returns the arc/edge section name at the given position. 
+    /// \brief Returns the arc/edge section name at the given position.
+    ///
+    /// Returns the arc/edge section name at the given position.
     /// \note It is synonym of \c edgeSection().
     const std::string& arcSection(int i) const {
@@ -2448,7 +2448,7 @@
     }
 
-    /// \brief Returns the section name at the given position. 
-    ///
-    /// Returns the section name at the given position. 
+    /// \brief Returns the section name at the given position.
+    ///
+    /// Returns the section name at the given position.
     /// \note It is synonym of \c arcSection().
     const std::string& edgeSection(int i) const {
@@ -2466,5 +2466,5 @@
     /// @}
 
-    /// \name Attribute sections   
+    /// \name Attribute sections
     /// @{
 
@@ -2476,7 +2476,7 @@
     }
 
-    /// \brief Returns the attribute section name at the given position. 
-    ///
-    /// Returns the attribute section name at the given position. 
+    /// \brief Returns the attribute section name at the given position.
+    ///
+    /// Returns the attribute section name at the given position.
     const std::string& attributeSectionNames(int i) const {
       return _attribute_sections[i];
@@ -2492,5 +2492,5 @@
     /// @}
 
-    /// \name Extra sections   
+    /// \name Extra sections
     /// @{
 
@@ -2502,7 +2502,7 @@
     }
 
-    /// \brief Returns the extra section type at the given position. 
-    ///
-    /// Returns the section type at the given position. 
+    /// \brief Returns the extra section type at the given position.
+    ///
+    /// Returns the section type at the given position.
     const std::string& extraSection(int i) const {
       return _extra_sections[i];
@@ -2516,10 +2516,10 @@
       std::string str;
       while(++line_num, std::getline(*_is, str)) {
-	line.clear(); line.str(str);
-	char c;
-	if (line >> std::ws >> c && c != '#') {
-	  line.putback(c);
-	  return true;
-	}
+        line.clear(); line.str(str);
+        char c;
+        if (line >> std::ws >> c && c != '#') {
+          line.putback(c);
+          return true;
+        }
       }
       return false;
@@ -2533,5 +2533,5 @@
       char c;
       while (readSuccess() && line >> c && c != '@') {
-	readLine();
+        readLine();
       }
       line.putback(c);
@@ -2541,11 +2541,11 @@
       char c;
       if (!readLine() || !(line >> c) || c == '@') {
-	if (readSuccess() && line) line.putback(c);
-	return;
+        if (readSuccess() && line) line.putback(c);
+        return;
       }
       line.putback(c);
       std::string map;
       while (_reader_bits::readToken(line, map)) {
-	maps.push_back(map);
+        maps.push_back(map);
       }
     }
@@ -2555,9 +2555,9 @@
       char c;
       while (readSuccess() && line >> c && c != '@') {
-	line.putback(c);
-	std::string attr;
-	_reader_bits::readToken(line, attr);
-	attrs.push_back(attr);
-	readLine();
+        line.putback(c);
+        std::string attr;
+        _reader_bits::readToken(line, attr);
+        attrs.push_back(attr);
+        readLine();
       }
       line.putback(c);
@@ -2566,5 +2566,5 @@
   public:
 
-    /// \name Execution of the contents reader    
+    /// \name Execution of the contents reader
     /// @{
 
@@ -2579,35 +2579,35 @@
       while (readSuccess()) {
 
-	char c;
-	line >> c;
-
-	std::string section, caption;
-	_reader_bits::readToken(line, section);
-	_reader_bits::readToken(line, caption);
-
-	if (section == "nodes") {
-	  _node_sections.push_back(caption);
-	  _node_maps.push_back(std::vector<std::string>());
-	  readMaps(_node_maps.back());
-	  readLine(); skipSection();
-	} else if (section == "arcs" || section == "edges") {
-	  _edge_sections.push_back(caption);
-	  _arc_sections.push_back(section == "arcs");
-	  _edge_maps.push_back(std::vector<std::string>());
-	  readMaps(_edge_maps.back());
-	  readLine(); skipSection();
-	} else if (section == "attributes") {
-	  _attribute_sections.push_back(caption);
-	  _attributes.push_back(std::vector<std::string>());
-	  readAttributes(_attributes.back());
-	} else {
-	  _extra_sections.push_back(section);
-	  readLine(); skipSection();
-	}
+        char c;
+        line >> c;
+
+        std::string section, caption;
+        _reader_bits::readToken(line, section);
+        _reader_bits::readToken(line, caption);
+
+        if (section == "nodes") {
+          _node_sections.push_back(caption);
+          _node_maps.push_back(std::vector<std::string>());
+          readMaps(_node_maps.back());
+          readLine(); skipSection();
+        } else if (section == "arcs" || section == "edges") {
+          _edge_sections.push_back(caption);
+          _arc_sections.push_back(section == "arcs");
+          _edge_maps.push_back(std::vector<std::string>());
+          readMaps(_edge_maps.back());
+          readLine(); skipSection();
+        } else if (section == "attributes") {
+          _attribute_sections.push_back(caption);
+          _attributes.push_back(std::vector<std::string>());
+          readAttributes(_attributes.back());
+        } else {
+          _extra_sections.push_back(section);
+          readLine(); skipSection();
+        }
       }
     }
 
     /// @}
-    
+
   };
 }
