Index: src/lemon/bits/item_reader.h
===================================================================
--- src/lemon/bits/item_reader.h	(revision 1427)
+++ src/lemon/bits/item_reader.h	(revision 1429)
@@ -349,5 +349,5 @@
     void read(std::istream& is, Value& value) const {
       char c;
-      if (!(is >> c)) return;
+      if (!(is >> std::ws >> c)) return;
       is.putback(c);
       switch (c) {
Index: src/lemon/bits/item_writer.h
===================================================================
--- src/lemon/bits/item_writer.h	(revision 1415)
+++ src/lemon/bits/item_writer.h	(revision 1429)
@@ -178,4 +178,8 @@
   };
 
+  template <>
+  class DefaultWriter<std::string> 
+    : public QuotedStringWriter<std::string> {};
+
   template <typename Item>
   class DefaultWriter<std::vector<Item> > 
Index: src/lemon/graph_reader.h
===================================================================
--- src/lemon/graph_reader.h	(revision 1421)
+++ src/lemon/graph_reader.h	(revision 1429)
@@ -299,4 +299,20 @@
       reader->run();
     }
+
+    /// \brief Gives back the node by its id.
+    ///
+    /// It reads an id from the stream and gives back which node belongs to
+    /// it. It is possible only if there was read an "id" named node map.
+    Node readId(std::istream& is, Node) const {
+      return nodeset_reader.readId(is, Node());
+    } 
+
+    /// \brief Gives back the edge by its id.
+    ///
+    /// It reads an id from the stream and gives back which edge belongs to
+    /// it. It is possible only if there was read an "id" named edge map.
+    Edge readId(std::istream& is, Edge) const {
+      return edgeset_reader.readId(is, Edge());
+    } 
 
   private:
@@ -674,4 +690,11 @@
     ///
     /// Add a new labeled edge reader for the reader.
+    UndirGraphReader& readEdge(std::string name, Edge& edge) {
+      undir_edge_reader.readEdge(name, edge);
+    }
+
+    /// \brief Add a new labeled undirected edge reader for the reader.
+    ///
+    /// Add a new labeled undirected edge reader for the reader.
     UndirGraphReader& readUndirEdge(std::string name, UndirEdge& edge) {
       undir_edge_reader.readUndirEdge(name, edge);
@@ -713,4 +736,30 @@
       reader->run();
     }
+
+    /// \brief Gives back the node by its id.
+    ///
+    /// It reads an id from the stream and gives back which node belongs to
+    /// it. It is possible only if there was read an "id" named node map.
+    Node readId(std::istream& is, Node) const {
+      return nodeset_reader.readId(is, Node());
+    } 
+
+    /// \brief Gives back the edge by its id.
+    ///
+    /// It reads an id from the stream and gives back which edge belongs to
+    /// it. It is possible only if there was read an "id" named edge map.
+    Edge readId(std::istream& is, Edge) const {
+      return undir_edgeset_reader.readId(is, Edge());
+    } 
+
+    /// \brief Gives back the undirected edge by its id.
+    ///
+    /// It reads an id from the stream and gives back which undirected edge 
+    /// belongs to it. It is possible only if there was read an "id" named 
+    /// edge map.
+    UndirEdge readId(std::istream& is, UndirEdge) const {
+      return undir_edgeset_reader.readId(is, UndirEdge());
+    } 
+    
 
   private:
Index: src/lemon/graph_writer.h
===================================================================
--- src/lemon/graph_writer.h	(revision 1421)
+++ src/lemon/graph_writer.h	(revision 1429)
@@ -238,4 +238,20 @@
       writer->run();
     }
+
+    /// \brief Write the id of the given node.
+    ///
+    /// It writes the id of the given node. If there was written an "id"
+    /// named node map then it will write the map value belongs to the node.
+    void writeId(std::ostream& os, const Node& item) const {
+      nodeset_writer.writeId(os, item);
+    } 
+
+    /// \brief Write the id of the given edge.
+    ///
+    /// It writes the id of the given edge. If there was written an "id"
+    /// named edge map then it will write the map value belongs to the edge.
+    void writeId(std::ostream& os, const Edge& item) const {
+      edgeset_writer.writeId(os, item);
+    } 
 
   private:
@@ -548,4 +564,11 @@
     ///
     /// Add a new labeled edge writer for the writer.
+    UndirGraphWriter& writeEdge(std::string name, const Edge& edge) {
+      undir_edge_writer.writeEdge(name, edge);
+    }
+
+    /// \brief Add a new labeled undirected edge writer for the writer.
+    ///
+    /// Add a new labeled undirected edge writer for the writer.
     UndirGraphWriter& writeUndirEdge(std::string name, const UndirEdge& edge) {
       undir_edge_writer.writeUndirEdge(name, edge);
@@ -587,4 +610,30 @@
       writer->run();
     }
+
+    /// \brief Write the id of the given node.
+    ///
+    /// It writes the id of the given node. If there was written an "id"
+    /// named node map then it will write the map value belongs to the node.
+    void writeId(std::ostream& os, const Node& item) const {
+      nodeset_writer.writeId(os, item);
+    } 
+
+    /// \brief Write the id of the given edge.
+    ///
+    /// It writes the id of the given edge. If there was written an "id"
+    /// named edge map then it will write the map value belongs to the edge.
+    void writeId(std::ostream& os, const Edge& item) const {
+      undir_edgeset_writer.writeId(os, item);
+    } 
+
+    /// \brief Write the id of the given undirected edge.
+    ///
+    /// It writes the id of the given undirected edge. If there was written 
+    /// an "id" named edge map then it will write the map value belongs to 
+    /// the edge.
+    void writeId(std::ostream& os, const UndirEdge& item) const {
+      undir_edgeset_writer.writeId(os, item);
+    } 
+
 
   private:
Index: src/lemon/lemon_reader.h
===================================================================
--- src/lemon/lemon_reader.h	(revision 1427)
+++ src/lemon/lemon_reader.h	(revision 1429)
@@ -546,5 +546,5 @@
 
       virtual Item read(std::istream& is) const {
-	return boxedIdReader.readId(is);
+	return boxedIdReader.readId(is, Item());
       }
     };
@@ -598,5 +598,5 @@
     typedef _Graph Graph;
     typedef _Traits Traits;
-    typedef typename Graph::Node Item;
+    typedef typename Graph::Node Node;
     typedef typename Traits::Skipper DefaultSkipper;
 
@@ -653,7 +653,6 @@
     NodeSetReader& readNodeMap(std::string name, Map& map, 
 			       const Reader& reader = Reader()) {
-      return _readMap<
-	typename Traits::template Reader<typename Map::Value>, Map,
-	typename SmartParameter<Map>::Type>(name, map, reader);
+      return _readMap<Reader, Map, typename SmartParameter<Map>::Type>
+	(name, map, reader);
     }
 
@@ -661,7 +660,6 @@
     NodeSetReader& readNodeMap(std::string name, const Map& map, 
 			       const Reader& reader = Reader()) {
-      return _readMap<
-	typename Traits::template Reader<typename Map::Value>, Map, 
-	typename SmartParameter<Map>::Type>(name, map, reader);
+      return _readMap<Reader, Map, typename SmartParameter<Map>::Type>
+	(name, map, reader);
     }
 
@@ -677,5 +675,5 @@
       }
       readers.insert(
-	make_pair(name, new MapReader<Item, Map, Reader>(map, reader)));
+	make_pair(name, new MapReader<Node, Map, Reader>(map, reader)));
       return *this;
     }
@@ -694,5 +692,5 @@
 	throw IOParameterError(msg.message());
       }
-      readers.insert(make_pair(name, new SkipReader<Item, Reader>(reader)));
+      readers.insert(make_pair(name, new SkipReader<Node, Reader>(reader)));
       return *this;
     }
@@ -717,5 +715,5 @@
     /// It reads the content of the section.
     virtual void read(std::istream& is) {
-      std::vector<ReaderBase<Item>* > index;
+      std::vector<ReaderBase<Node>* > index;
       std::string line;
 
@@ -735,5 +733,5 @@
       }
       while (getline(is, line)) {	
-	typename Graph::Node node = graph.addNode();
+	Node node = graph.addNode();
 	std::istringstream ls(line);
 	for (int i = 0; i < (int)index.size(); ++i) {
@@ -757,5 +755,5 @@
     /// It reads an id from the stream and gives back which node belongs to
     /// it. It is possible only if there was read an "id" named map.
-    Item readId(std::istream& is) const {
+    Node readId(std::istream& is, Node = Node()) const {
       return inverter->read(is);
     } 
@@ -763,12 +761,12 @@
   private:
 
-    typedef std::map<std::string, ReaderBase<Item>*> MapReaders;
+    typedef std::map<std::string, ReaderBase<Node>*> MapReaders;
     MapReaders readers;
    
     typename SmartReference<Graph>::Type graph;   
     std::string id;
-    SkipReader<Item, DefaultSkipper> skipper;
-
-    std::auto_ptr<InverterBase<Item> > inverter;
+    SkipReader<Node, DefaultSkipper> skipper;
+
+    std::auto_ptr<InverterBase<Node> > inverter;
   };
 
@@ -802,5 +800,6 @@
     typedef _Graph Graph;
     typedef _Traits Traits;
-    typedef typename Graph::Edge Item;
+    typedef typename Graph::Node Node;
+    typedef typename Graph::Edge Edge;
     typedef typename Traits::Skipper DefaultSkipper;
 
@@ -820,6 +819,5 @@
 		  const DefaultSkipper& _skipper = DefaultSkipper()) 
       : Parent(_reader), graph(_graph), id(_id), skipper(_skipper),
-	nodeIdReader(new IdReader<typename Graph::Node, NodeIdReader>
-		     (_nodeIdReader)) {} 
+	nodeIdReader(new IdReader<Node, NodeIdReader>(_nodeIdReader)) {} 
 
     /// \brief Destructor.
@@ -862,6 +860,5 @@
     EdgeSetReader& readEdgeMap(std::string name, Map& map, 
 			   const Reader& reader = Reader()) {
-      return _readMap<
-	typename Traits::template Reader<typename Map::Value>, Map,
+      return _readMap<Reader, Map,
 	typename SmartParameter<Map>::Type>(name, map, reader);
     }
@@ -870,6 +867,5 @@
     EdgeSetReader& readEdgeMap(std::string name, const Map& map, 
 			       const Reader& reader = Reader()) {
-      return _readMap<
-	typename Traits::template Reader<typename Map::Value>, Map,
+      return _readMap<Reader, Map,
 	typename SmartParameter<Map>::Type>(name, map, reader);
     }
@@ -886,5 +882,5 @@
       }
       readers.insert(
-	make_pair(name, new MapReader<Item, Map, Reader>(map, reader)));
+	make_pair(name, new MapReader<Edge, Map, Reader>(map, reader)));
       return *this;
     }
@@ -903,5 +899,5 @@
 	throw IOParameterError(msg.message());
       }
-      readers.insert(make_pair(name, new SkipReader<Item, Reader>(reader)));
+      readers.insert(make_pair(name, new SkipReader<Edge, Reader>(reader)));
       return *this;
     }
@@ -926,5 +922,5 @@
     /// It reads the content of the section.
     virtual void read(std::istream& is) {
-      std::vector<ReaderBase<Item>* > index;
+      std::vector<ReaderBase<Edge>* > index;
       std::string line;
 
@@ -945,7 +941,7 @@
       while (getline(is, line)) {	
 	std::istringstream ls(line);
-	typename Graph::Node from = nodeIdReader->read(ls);
-	typename Graph::Node to = nodeIdReader->read(ls);
-	typename Graph::Edge edge = graph.addEdge(from, to);
+	Node from = nodeIdReader->read(ls);
+	Node to = nodeIdReader->read(ls);
+	Edge edge = graph.addEdge(from, to);
 	for (int i = 0; i < (int)index.size(); ++i) {
 	  index[i]->read(ls, edge);
@@ -968,5 +964,5 @@
     /// It reads an id from the stream and gives back which edge belongs to
     /// it. It is possible only if there was read an "id" named map.
-    Item readId(std::istream& is) const {
+    Edge readId(std::istream& is, Edge = Edge()) const {
       return inverter->read(is);
     } 
@@ -974,13 +970,13 @@
   private:
 
-    typedef std::map<std::string, ReaderBase<Item>*> MapReaders;
+    typedef std::map<std::string, ReaderBase<Edge>*> MapReaders;
     MapReaders readers;
    
     typename SmartReference<Graph>::Type graph;   
     std::string id;
-    SkipReader<Item, DefaultSkipper> skipper;
-
-    std::auto_ptr<InverterBase<Item> > inverter;
-    std::auto_ptr<IdReaderBase<typename Graph::Node> > nodeIdReader;
+    SkipReader<Edge, DefaultSkipper> skipper;
+
+    std::auto_ptr<InverterBase<Edge> > inverter;
+    std::auto_ptr<IdReaderBase<Node> > nodeIdReader;
   };
 
@@ -1019,5 +1015,7 @@
     typedef _Graph Graph;
     typedef _Traits Traits;
-    typedef typename Graph::UndirEdge Item;
+    typedef typename Graph::Node Node;
+    typedef typename Graph::Edge Edge;
+    typedef typename Graph::UndirEdge UndirEdge;
     typedef typename Traits::Skipper DefaultSkipper;
 
@@ -1037,6 +1035,5 @@
 		       const DefaultSkipper& _skipper = DefaultSkipper()) 
       : Parent(_reader), graph(_graph), id(_id), skipper(_skipper),
-	nodeIdReader(new IdReader<typename Graph::Node, NodeIdReader>
-		     (_nodeIdReader)) {} 
+	nodeIdReader(new IdReader<Node, NodeIdReader>(_nodeIdReader)) {} 
 
     /// \brief Destructor.
@@ -1101,5 +1098,5 @@
       }
       readers.insert(
-	make_pair(name, new MapReader<Item, Map, Reader>(map, reader)));
+	make_pair(name, new MapReader<UndirEdge, Map, Reader>(map, reader)));
       return *this;
     }
@@ -1118,5 +1115,6 @@
 	throw IOParameterError(msg.message());
       }
-      readers.insert(make_pair(name, new SkipReader<Item, Reader>(reader)));
+      readers.insert(make_pair(name, 
+			       new SkipReader<UndirEdge, Reader>(reader)));
       return *this;
     }
@@ -1200,5 +1198,5 @@
     /// It reads the content of the section.
     virtual void read(std::istream& is) {
-      std::vector<ReaderBase<Item>* > index;
+      std::vector<ReaderBase<UndirEdge>* > index;
       std::string line;
 
@@ -1219,7 +1217,7 @@
       while (getline(is, line)) {	
 	std::istringstream ls(line);
-	typename Graph::Node from = nodeIdReader->read(ls);
-	typename Graph::Node to = nodeIdReader->read(ls);
-	typename Graph::UndirEdge edge = graph.addEdge(from, to);
+	Node from = nodeIdReader->read(ls);
+	Node to = nodeIdReader->read(ls);
+	UndirEdge edge = graph.addEdge(from, to);
 	for (int i = 0; i < (int)index.size(); ++i) {
 	  index[i]->read(ls, edge);
@@ -1242,19 +1240,39 @@
     /// It reads an id from the stream and gives back which undirected edge 
     /// belongs to it. It is possible only if there was read an "id" named map.
-    Item readId(std::istream& is) const {
+    UndirEdge readId(std::istream& is, UndirEdge = UndirEdge()) const {
       return inverter->read(is);
     } 
 
-  private:
-
-    typedef std::map<std::string, ReaderBase<Item>*> MapReaders;
+    /// \brief Gives back the directed edge by its id.
+    ///
+    /// It reads an id from the stream and gives back which directed edge 
+    /// belongs to it. The directed edge id is the \c '+' or \c '-' character
+    /// and the undirected edge id. It is possible only if there was read 
+    /// an "id" named map.
+    Edge readId(std::istream& is, Edge = Edge()) const {
+      char c;
+      is >> c;
+      UndirEdge undirEdge = inverter->read(is);
+      if (c == '+') {
+	return graph.edgeWithSource(undirEdge, graph.source(undirEdge));
+      } else if (c == '-') {
+	return graph.edgeWithSource(undirEdge, graph.target(undirEdge));
+      } else {
+	throw DataFormatError("Wrong id format for edge "
+			      "in undirected edgeset");
+      }
+    } 
+
+  private:
+
+    typedef std::map<std::string, ReaderBase<UndirEdge>*> MapReaders;
     MapReaders readers;
    
     typename SmartReference<Graph>::Type graph;   
     std::string id;
-    SkipReader<Item, DefaultSkipper> skipper;
-
-    std::auto_ptr<InverterBase<Item> > inverter;
-    std::auto_ptr<IdReaderBase<typename Graph::Node> > nodeIdReader;
+    SkipReader<UndirEdge, DefaultSkipper> skipper;
+
+    std::auto_ptr<InverterBase<UndirEdge> > inverter;
+    std::auto_ptr<IdReaderBase<Node> > nodeIdReader;
   };
 
@@ -1273,5 +1291,5 @@
     typedef CommonSectionReaderBase Parent;
     typedef _Graph Graph;
-    typedef typename Graph::Node Item;
+    typedef typename Graph::Node Node;
   public:
     
@@ -1302,5 +1320,5 @@
     ///
     /// Add a node reader command for the NodeReader.
-    void readNode(const std::string& name, Item& item) {
+    void readNode(const std::string& name, Node& item) {
       if (readers.find(name) != readers.end()) {
 	ErrorMessage msg;
@@ -1335,5 +1353,5 @@
 	std::string id;
 	ls >> id;
-	typename ItemReaders::iterator it = readers.find(id);
+	typename NodeReaders::iterator it = readers.find(id);
 	if (it != readers.end()) {
 	  *(it->second) = idReader->read(ls); 
@@ -1346,7 +1364,7 @@
     std::string id;
 
-    typedef std::map<std::string, Item*> ItemReaders;
-    ItemReaders readers;
-    std::auto_ptr<IdReaderBase<Item> > idReader;
+    typedef std::map<std::string, Node*> NodeReaders;
+    NodeReaders readers;
+    std::auto_ptr<IdReaderBase<Node> > idReader;
   };
 
@@ -1365,5 +1383,5 @@
     typedef CommonSectionReaderBase Parent;
     typedef _Graph Graph;
-    typedef typename Graph::Edge Item;
+    typedef typename Graph::Edge Edge;
   public:
     
@@ -1393,5 +1411,5 @@
     ///
     /// Add an edge reader command for the EdgeReader.
-    void readEdge(const std::string& name, Item& item) {
+    void readEdge(const std::string& name, Edge& item) {
       if (readers.find(name) != readers.end()) {
 	ErrorMessage msg;
@@ -1426,5 +1444,5 @@
 	std::string id;
 	ls >> id;
-	typename ItemReaders::iterator it = readers.find(id);
+	typename EdgeReaders::iterator it = readers.find(id);
 	if (it != readers.end()) {
 	  *(it->second) = idReader->read(ls); 
@@ -1437,7 +1455,7 @@
     std::string id;
 
-    typedef std::map<std::string, Item*> ItemReaders;
-    ItemReaders readers;
-    std::auto_ptr<IdReaderBase<Item> > idReader;
+    typedef std::map<std::string, Edge*> EdgeReaders;
+    EdgeReaders readers;
+    std::auto_ptr<IdReaderBase<Edge> > idReader;
   };
 
@@ -1456,5 +1474,6 @@
     typedef CommonSectionReaderBase Parent;
     typedef _Graph Graph;
-    typedef typename Graph::UndirEdge Item;
+    typedef typename Graph::Edge Edge;
+    typedef typename Graph::UndirEdge UndirEdge;
   public:
     
@@ -1470,5 +1489,6 @@
 	       const std::string& _id = std::string()) 
       : Parent(_reader), id(_id), 
-	idReader(new IdReader<typename Graph::UndirEdge, _IdReader>(_idReader))
+	undirEdgeIdReader(new IdReader<UndirEdge, _IdReader>(_idReader)),
+	edgeIdReader(new IdReader<Edge, _IdReader>(_idReader))
     {} 
 
@@ -1486,11 +1506,23 @@
     ///
     /// Add an undirected edge reader command for the UndirEdgeReader.
-    void readUndirEdge(const std::string& name, Item& item) {
-      if (readers.find(name) != readers.end()) {
+    void readUndirEdge(const std::string& name, UndirEdge& item) {
+      if (undirEdgeReaders.find(name) != undirEdgeReaders.end()) {
+	ErrorMessage msg;
+	msg << "Multiple read rule for undirected edge: " << name;
+	throw IOParameterError(msg.message());
+      }
+      undirEdgeReaders.insert(make_pair(name, &item));
+    }
+
+    /// \brief Add an edge reader command for the UndirEdgeReader.
+    ///
+    /// Add an edge reader command for the UndirEdgeReader.
+    void readEdge(const std::string& name, Edge& item) {
+      if (edgeReaders.find(name) != edgeReaders.end()) {
 	ErrorMessage msg;
 	msg << "Multiple read rule for edge: " << name;
 	throw IOParameterError(msg.message());
       }
-      readers.insert(make_pair(name, &item));
+      edgeReaders.insert(make_pair(name, &item));
     }
 
@@ -1507,5 +1539,5 @@
       std::string name;
       ls >> command >> name;
-      return command == "@edges" && name == id;
+      return command == "@undiredges" && name == id;
     }
 
@@ -1519,8 +1551,17 @@
 	std::string id;
 	ls >> id;
-	typename ItemReaders::iterator it = readers.find(id);
-	if (it != readers.end()) {
-	  *(it->second) = idReader->read(ls); 
-	}	
+	{
+	  typename UndirEdgeReaders::iterator it = undirEdgeReaders.find(id);
+	  if (it != undirEdgeReaders.end()) {
+	    *(it->second) = undirEdgeIdReader->read(ls); 
+	    break;
+	  }	
+	} {
+	  typename EdgeReaders::iterator it = edgeReaders.find(id);
+	  if (it != edgeReaders.end()) {
+	    *(it->second) = edgeIdReader->read(ls); 
+	    break;
+	  }	
+	}
       }
     }
@@ -1530,7 +1571,11 @@
     std::string id;
 
-    typedef std::map<std::string, Item*> ItemReaders;
-    ItemReaders readers;
-    std::auto_ptr<IdReaderBase<Item> > idReader;
+    typedef std::map<std::string, UndirEdge*> UndirEdgeReaders;
+    UndirEdgeReaders undirEdgeReaders;
+    std::auto_ptr<IdReaderBase<UndirEdge> > undirEdgeIdReader;
+
+    typedef std::map<std::string, Edge*> EdgeReaders;
+    EdgeReaders edgeReaders;
+    std::auto_ptr<IdReaderBase<Edge> > edgeIdReader;
   };
 
Index: src/lemon/lemon_writer.h
===================================================================
--- src/lemon/lemon_writer.h	(revision 1421)
+++ src/lemon/lemon_writer.h	(revision 1429)
@@ -244,5 +244,5 @@
 
       virtual void write(std::ostream& os, const Item& item) const {
-	return idWriter.writeId(os, item);
+	idWriter.writeId(os, item);
       }
     };
@@ -274,5 +274,5 @@
     typedef _Graph Graph;
     typedef _Traits Traits;
-    typedef typename Graph::Node Item;
+    typedef typename Graph::Node Node;
 
     /// \brief Constructor.
@@ -320,5 +320,5 @@
 			    const Writer& writer = Writer()) {
       writers.push_back(
-	make_pair(name, new MapWriter<Item, Map, Writer>(map, writer)));
+	make_pair(name, new MapWriter<Node, Map, Writer>(map, writer)));
       return *this;
     }
@@ -380,5 +380,5 @@
     /// Otherwise if the \c forceId parameter was true it will write
     /// its id in the graph. 
-    void writeId(std::ostream& os, const Item& item) const {
+    void writeId(std::ostream& os, const Node& item) const {
       if (forceIdMap) {
 	os << graph.id(item);
@@ -390,8 +390,8 @@
   private:
 
-    typedef std::vector<std::pair<std::string, WriterBase<Item>*> > MapWriters;
+    typedef std::vector<std::pair<std::string, WriterBase<Node>*> > MapWriters;
     MapWriters writers;
 
-    WriterBase<Item>* idMap;
+    WriterBase<Node>* idMap;
     bool forceIdMap;
    
@@ -431,5 +431,6 @@
     typedef _Graph Graph;
     typedef _Traits Traits;
-    typedef typename Graph::Edge Item;
+    typedef typename Graph::Node Node;
+    typedef typename Graph::Edge Edge;
 
     /// \brief Constructor.
@@ -447,6 +448,5 @@
       : Parent(_writer), idMap(0), forceIdMap(_forceIdMap),
 	graph(_graph), id(_id),
-	nodeIdWriter(new IdWriter<typename Graph::Node, NodeIdWriter>
-		     (_nodeIdWriter)) {} 
+	nodeIdWriter(new IdWriter<Node, NodeIdWriter>(_nodeIdWriter)) {} 
 
     /// \brief Destructor.
@@ -482,5 +482,5 @@
 			    const Writer& writer = Writer()) {
       writers.push_back(
-	make_pair(name, new MapWriter<Item, Map, Writer>(map, writer)));
+	make_pair(name, new MapWriter<Edge, Map, Writer>(map, writer)));
       return *this;
     }
@@ -547,5 +547,5 @@
     /// Otherwise if the \c forceId parameter was true it will write
     /// its id in the graph. 
-    void writeId(std::ostream& os, const Item& item) const {
+    void writeId(std::ostream& os, const Edge& item) const {
       if (forceIdMap) {
 	os << graph.id(item);
@@ -557,8 +557,8 @@
   private:
 
-    typedef std::vector<std::pair<std::string, WriterBase<Item>*> > MapWriters;
+    typedef std::vector<std::pair<std::string, WriterBase<Edge>*> > MapWriters;
     MapWriters writers;
 
-    WriterBase<Item>* idMap;
+    WriterBase<Edge>* idMap;
     bool forceIdMap;
    
@@ -566,5 +566,5 @@
     std::string id;
 
-    std::auto_ptr<IdWriterBase<typename Graph::Node> > nodeIdWriter;
+    std::auto_ptr<IdWriterBase<Node> > nodeIdWriter;
   };
 
@@ -605,5 +605,7 @@
     typedef _Graph Graph;
     typedef _Traits Traits;
-    typedef typename Graph::UndirEdge Item;
+    typedef typename Graph::Node Node;
+    typedef typename Graph::Edge Edge;
+    typedef typename Graph::UndirEdge UndirEdge;
 
     /// \brief Constructor.
@@ -621,6 +623,5 @@
       : Parent(_writer), idMap(0), forceIdMap(_forceIdMap),
 	graph(_graph), id(_id),
-	nodeIdWriter(new IdWriter<typename Graph::Node, NodeIdWriter>
-		     (_nodeIdWriter)) {} 
+	nodeIdWriter(new IdWriter<Node, NodeIdWriter>(_nodeIdWriter)) {} 
 
     /// \brief Destructor.
@@ -656,5 +657,5 @@
 					  const Writer& writer = Writer()) {
       writers.push_back(
-	make_pair(name, new MapWriter<Item, Map, Writer>(map, writer)));
+	make_pair(name, new MapWriter<UndirEdge, Map, Writer>(map, writer)));
       return *this;
     }
@@ -743,5 +744,5 @@
     /// undirected edge. Otherwise if the \c forceId parameter was true it 
     /// will write its id in the graph. 
-    void writeId(std::ostream& os, const Item& item) const {
+    void writeId(std::ostream& os, const UndirEdge& item) const {
       if (forceIdMap) {
 	os << graph.id(item);
@@ -751,10 +752,31 @@
     } 
 
-  private:
-
-    typedef std::vector<std::pair<std::string, WriterBase<Item>*> > MapWriters;
+    /// \brief Write the id of the given edge.
+    ///
+    /// It writes the id of the given edge. If there was written 
+    /// an "id" named map then it will write the map value belongs to the 
+    /// edge. Otherwise if the \c forceId parameter was true it 
+    /// will write its id in the graph. If the edge is forward map
+    /// then its prefix character is \c '+' elsewhere \c '-'.
+    void writeId(std::ostream& os, const Edge& item) const {
+      if (graph.forward(item)) {
+	os << "+ ";
+      } else {
+	os << "- ";
+      }
+      if (forceIdMap) {
+	os << graph.id(item);
+      } else {
+	idMap->write(os, item);
+      }
+    } 
+
+  private:
+
+    typedef std::vector<std::pair<std::string, 
+				  WriterBase<UndirEdge>*> > MapWriters;
     MapWriters writers;
 
-    WriterBase<Item>* idMap;
+    WriterBase<UndirEdge>* idMap;
     bool forceIdMap;
    
@@ -762,5 +784,5 @@
     std::string id;
 
-    std::auto_ptr<IdWriterBase<typename Graph::Node> > nodeIdWriter;
+    std::auto_ptr<IdWriterBase<Node> > nodeIdWriter;
   };
 
@@ -779,5 +801,5 @@
     typedef CommonSectionWriterBase Parent;
     typedef _Graph Graph;
-    typedef typename Graph::Node Item;
+    typedef typename Graph::Node Node;
   public:
     
@@ -807,5 +829,5 @@
     ///
     /// Add a node writer command for the NodeWriter.
-    void writeNode(const std::string& name, const Item& item) {
+    void writeNode(const std::string& name, const Node& item) {
       writers.push_back(make_pair(name, &item));
     }
@@ -836,7 +858,7 @@
     std::string id;
 
-    typedef std::vector<std::pair<std::string, const Item*> > ItemWriters;
-    ItemWriters writers;
-    std::auto_ptr<IdWriterBase<Item> > idWriter;
+    typedef std::vector<std::pair<std::string, const Node*> > NodeWriters;
+    NodeWriters writers;
+    std::auto_ptr<IdWriterBase<Node> > idWriter;
   };
 
@@ -855,5 +877,5 @@
     typedef CommonSectionWriterBase Parent;
     typedef _Graph Graph;
-    typedef typename Graph::Edge Item;
+    typedef typename Graph::Edge Edge;
   public:
     
@@ -882,5 +904,5 @@
     ///
     /// Add an edge writer command for the EdgeWriter.
-    void writeEdge(const std::string& name, const Item& item) {
+    void writeEdge(const std::string& name, const Edge& item) {
       writers.push_back(make_pair(name, &item));
     }
@@ -911,8 +933,8 @@
     std::string id;
 
-    typedef std::vector<std::pair<std::string, const Item*> > ItemWriters;
-    ItemWriters writers;
-
-    std::auto_ptr<IdWriterBase<Item> > idWriter;
+    typedef std::vector<std::pair<std::string, const Edge*> > EdgeWriters;
+    EdgeWriters writers;
+
+    std::auto_ptr<IdWriterBase<Edge> > idWriter;
   };
 
@@ -931,5 +953,7 @@
     typedef CommonSectionWriterBase Parent;
     typedef _Graph Graph;
-    typedef typename Graph::UndirEdge Item;
+    typedef typename Graph::Node Node;
+    typedef typename Graph::Edge Edge;
+    typedef typename Graph::UndirEdge UndirEdge;
   public:
     
@@ -944,6 +968,6 @@
 	       const std::string& _id = std::string()) 
       : Parent(_writer), id(_id), 
-	idWriter(new IdWriter<typename Graph::UndirEdge, _IdWriter>
-		 (_idWriter)) {} 
+	undirEdgeIdWriter(new IdWriter<UndirEdge, _IdWriter>(_idWriter)),
+	edgeIdWriter(new IdWriter<Edge, _IdWriter>(_idWriter)) {}
 
     /// \brief Destructor.
@@ -957,9 +981,16 @@
   public:
 
+    /// \brief Add an edge writer command for the UndirEdgeWriter.
+    ///
+    /// Add an edge writer command for the UndirEdgeWriter.
+    void writeEdge(const std::string& name, const Edge& item) {
+      edgeWriters.push_back(make_pair(name, &item));
+    }
+
     /// \brief Add an undirected edge writer command for the UndirEdgeWriter.
     ///
-    /// Add an edge writer command for the UndirEdgeWriter.
-    void writeUndirEdge(const std::string& name, const Item& item) {
-      writers.push_back(make_pair(name, &item));
+    /// Add an undirected edge writer command for the UndirEdgeWriter.
+    void writeUndirEdge(const std::string& name, const UndirEdge& item) {
+      undirEdgeWriters.push_back(make_pair(name, &item));
     }
 
@@ -971,5 +1002,5 @@
     /// and the header line's id and the writer's id are the same.
     virtual std::string header() {
-      return "@edges " + id;
+      return "@undiredges " + id;
     }
 
@@ -978,9 +1009,14 @@
     /// Write the content of the section.
     virtual void write(std::ostream& os) {
-      for (int i = 0; i < (int)writers.size(); ++i) {
-	os << writers[i].first << ' ';
-	idWriter->write(os, *(writers[i].second));
+      for (int i = 0; i < (int)undirEdgeWriters.size(); ++i) {
+	os << undirEdgeWriters[i].first << ' ';
+	undirEdgeIdWriter->write(os, *(undirEdgeWriters[i].second));
 	os << std::endl;
       }
+      for (int i = 0; i < (int)edgeWriters.size(); ++i) {
+	os << edgeWriters[i].first << ' ';
+	edgeIdWriter->write(os, *(edgeWriters[i].second));
+	os << std::endl;
+      }
     }
     
@@ -989,8 +1025,13 @@
     std::string id;
 
-    typedef std::vector<std::pair<std::string, const Item*> > ItemWriters;
-    ItemWriters writers;
-
-    std::auto_ptr<IdWriterBase<Item> > idWriter;
+    typedef std::vector<std::pair<std::string, 
+				  const UndirEdge*> > UndirEdgeWriters;
+    UndirEdgeWriters undirEdgeWriters;
+    std::auto_ptr<IdWriterBase<UndirEdge> > undirEdgeIdWriter;
+
+    typedef std::vector<std::pair<std::string, const Edge*> > EdgeWriters;
+    EdgeWriters edgeWriters;
+    std::auto_ptr<IdWriterBase<Edge> > edgeIdWriter;
+
   };
 
