Index: graph_displayer_canvas-event.cc
===================================================================
--- graph_displayer_canvas-event.cc	(revision 63)
+++ graph_displayer_canvas-event.cc	(revision 64)
@@ -241,8 +241,4 @@
       mapstorage.coords.set(active_node, xy<double>(clicked_x, clicked_y));
 
-      // update id map
-      (*mapstorage.nodemap_storage["id"])[active_node] =
-        mapstorage.graph.id(active_node);
-
       // update all other maps
       for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
@@ -250,7 +246,6 @@
           mapstorage.nodemap_storage.end(); ++it)
       {
-        if ((it->first != "id") &&
-            (it->first != "coordinates_x") &&
-            (it->first != "coordiantes_y"))
+        if ((it->first != "coordinates_x") &&
+            (it->first != "coordinates_y"))
         {
           (*(it->second))[active_node] =
@@ -258,4 +253,6 @@
         }
       }
+      // increment the id map's default value
+      mapstorage.nodemap_default["id"] += 1.0;
 
       nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
@@ -357,9 +354,5 @@
                   target_node);
 
-              // update id map
-              (*mapstorage.edgemap_storage["id"])[active_edge] = 
-                mapstorage.graph.id(active_edge);
- 
-              // update all other maps
+              // update maps
               for (std::map<std::string,
                   Graph::EdgeMap<double>*>::const_iterator it =
@@ -367,10 +360,9 @@
                   mapstorage.edgemap_storage.end(); ++it)
               {
-                if (it->first != "id")
-                {
-                  (*(it->second))[active_edge] =
-                    mapstorage.edgemap_default[it->first];
-                }
+                (*(it->second))[active_edge] =
+                  mapstorage.edgemap_default[it->first];
               }
+              // increment the id map's default value
+              mapstorage.edgemap_default["id"] += 1.0;
 
               //calculating coordinates of new edge
Index: mapstorage.cc
===================================================================
--- mapstorage.cc	(revision 63)
+++ mapstorage.cc	(revision 64)
@@ -12,4 +12,7 @@
   nodemap_storage["id"] = new Graph::NodeMap<double>(graph);
   edgemap_storage["id"] = new Graph::EdgeMap<double>(graph);
+
+  nodemap_default["id"] = 1.0;
+  edgemap_default["id"] = 1.0;
 }
 
@@ -126,4 +129,5 @@
   bool read_x = false;
   bool read_y = false;
+  bool read_edge_id = false;
 
   try {
@@ -183,4 +187,14 @@
   }
 
+  if (!read_edge_id)
+  {
+    edgemap_storage["id"] = new Graph::EdgeMap<double>(graph);
+    int i = 1;
+    for (EdgeIt e(graph); e != INVALID; ++e)
+    {
+      (*edgemap_storage["id"])[e] = i++;
+    }
+  }
+
   if (!read_x || !read_y)
   {
@@ -211,4 +225,15 @@
       nodemap_default[it->first] = 0.0;
     }
+    else if (it->first == "id")
+    {
+      NodeIt n(graph);
+      double max = (*nodemap_storage["id"])[n];
+      for (; n != INVALID; ++n)
+      {
+        if ((*nodemap_storage["id"])[n] > max)
+          max = (*nodemap_storage["id"])[n];
+      }
+      nodemap_default["id"] = max + 1.0;
+    }
   }
   for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it =
@@ -218,4 +243,15 @@
     {
       edgemap_default[it->first] = 0.0;
+    }
+    else
+    {
+      EdgeIt e(graph);
+      double max = (*edgemap_storage["id"])[e];
+      for (; e != INVALID; ++e)
+      {
+        if ((*edgemap_storage["id"])[e] > max)
+          max = (*edgemap_storage["id"])[e];
+      }
+      edgemap_default["id"] = max + 1.0;
     }
   }
@@ -268,10 +304,12 @@
       nodemap_default.begin(); it != nodemap_default.end(); ++it)
   {
-    nodemap_default.erase(it);
+    if (it->first != "id")
+      nodemap_default.erase(it);
   }
   for (std::map<std::string, double>::iterator it =
       edgemap_default.begin(); it != edgemap_default.end(); ++it)
   {
-    edgemap_default.erase(it);
+    if (it->first != "id")
+      edgemap_default.erase(it);
   }
   graph.clear();
