Index: src/work/list_graph.hh
===================================================================
--- src/work/list_graph.hh	(revision 69)
+++ src/work/list_graph.hh	(revision 75)
@@ -45,6 +45,8 @@
       NodeMap(const ListGraph& _G, T a) : 
 	G(_G), container(G.node_id, a) { }
-      void set(NodeIt nit, T a) { container[G.id(nit)]=a; }
-      T get(NodeIt nit) const { return container[G.id(nit)]; }
+      void set(NodeIt n, T a) { container[/*G.id(n)*/n.node->id]=a; }
+      T get(NodeIt n) const { return container[/*G.id(n)*/n.node->id]; }
+      T& operator[](NodeIt n) { return container[/*G.id(n)*/n.node->id]; }
+      const T& operator[](NodeIt n) const { return container[/*G.id(n)*/n.node->id]; }
       void resize() { container.resize(G.node_id); }
       void resize(T a) { container.resize(G.node_id, a); }
@@ -61,6 +63,8 @@
       EdgeMap(const ListGraph& _G, T a) : 
 	G(_G), container(G.edge_id, a) { }
-      void set(EdgeIt eit, T a) { container[G.id(eit)]=a; }
-      T get(EdgeIt eit) const { return container[G.id(eit)]; }
+      void set(EdgeIt e, T a) { container[/*G.id(e)*/e.edge->id]=a; }
+      T get(EdgeIt e) const { return container[/*G.id(e)*/e.edge->id]; }
+      T& operator[](EdgeIt e) { return container[/*G.id(e)*/e.edge->id]; } 
+      const T& operator[](EdgeIt e) const { return container[/*G.id(e)*/e.edge->id]; } 
       void resize() { container.resize(G.edge_id); }
       void resize(T a) { container.resize(G.edge_id, a); }
@@ -77,4 +81,6 @@
     class node_item {
       friend class ListGraph;
+      template <typename T> friend class NodeMap;
+      
       friend class NodeIt;
       friend class EachNodeIt;
@@ -100,4 +106,6 @@
     class edge_item {
       friend class ListGraph;
+      template <typename T> friend class EdgeMap;
+
       friend class NodeIt;
       friend class EachNodeIt;
@@ -255,9 +263,14 @@
     /* for experimental purpose */
 
-    void getFirst(EachNodeIt& v) const { v=EachNodeIt(*this); }
-    void getFirst(EachEdgeIt& e) const { e=EachEdgeIt(*this); }
-    void getFirst(OutEdgeIt& e, NodeIt v) const { e=OutEdgeIt(v); }
-    void getFirst(InEdgeIt& e, NodeIt v) const { e=InEdgeIt(v); }
-    void getFirst(SymEdgeIt& e, NodeIt v) const { e=SymEdgeIt(v); }
+    EachNodeIt& getFirst(EachNodeIt& v) const { 
+      v=EachNodeIt(*this); return v; }
+    EachEdgeIt& getFirst(EachEdgeIt& e) const { 
+      e=EachEdgeIt(*this); return e; }
+    OutEdgeIt& getFirst(OutEdgeIt& e, NodeIt v) const { 
+      e=OutEdgeIt(v); return e; }
+    InEdgeIt& getFirst(InEdgeIt& e, NodeIt v) const { 
+      e=InEdgeIt(v); return e; }
+    SymEdgeIt& getFirst(SymEdgeIt& e, NodeIt v) const { 
+      e=SymEdgeIt(v); return e; }
     //void getTail(NodeIt& n, const EdgeIt& e) const { n=tail(e); }
     //void getHead(NodeIt& n, const EdgeIt& e) const { n=head(e); }
@@ -334,4 +347,5 @@
     class NodeIt {
       friend class ListGraph;
+      template <typename T> friend class NodeMap;
 
       friend class EdgeIt;
@@ -368,4 +382,5 @@
     class EdgeIt {
       friend class ListGraph;
+      template <typename T> friend class EdgeMap;
       
       friend class NodeIt;
@@ -414,30 +429,28 @@
     class OutEdgeIt : public EdgeIt {
       friend class ListGraph;
-      node_item* v;
-    protected:
-      OutEdgeIt(const NodeIt& _v) : v(_v.node) { edge=v->_first_out_edge; }
-    public:
-      OutEdgeIt() : EdgeIt(), v(0) { }
-      OutEdgeIt(const ListGraph& G, NodeIt _v) : v(_v.node) { edge=v->_first_out_edge; }
+      //node_item* v;
+    protected:
+      OutEdgeIt(const NodeIt& _v) /*: v(_v.node)*/ { edge=_v.node->_first_out_edge; }
+    public:
+      OutEdgeIt() : EdgeIt()/*, v(0)*/ { }
+      OutEdgeIt(const ListGraph& G, NodeIt _v) /*: v(_v.node)*/ { edge=_v.node->_first_out_edge; }
       OutEdgeIt& operator++() { edge=edge->_next_out; return *this; }
     protected:
-      NodeIt aNode() const { return NodeIt(v); }
-      NodeIt bNode() const { 
-	return (edge->_tail==v) ? NodeIt(edge->_head) : NodeIt(edge->_tail); }
+      NodeIt aNode() const { return NodeIt(edge->_tail); }
+      NodeIt bNode() const { return NodeIt(edge->_head); }
     };
     
     class InEdgeIt : public EdgeIt {
       friend class ListGraph;
-      node_item* v;
-    protected:
-      InEdgeIt(const NodeIt& _v) : v(_v.node) { edge=v->_first_in_edge; }
-    public:
-      InEdgeIt() : EdgeIt(), v(0) { }
-      InEdgeIt(const ListGraph& G, NodeIt _v) : v(_v.node) { edge=v->_first_in_edge; }
+      //node_item* v;
+    protected:
+      InEdgeIt(const NodeIt& _v) /*: v(_v.node)*/ { edge=_v.node->_first_in_edge; }
+    public:
+      InEdgeIt() : EdgeIt()/*, v(0)*/ { }
+      InEdgeIt(const ListGraph& G, NodeIt _v) /*: v(_v.node)*/ { edge=_v.node->_first_in_edge; }
       InEdgeIt& operator++() { edge=edge->_next_in; return *this; }
     protected:
-      NodeIt aNode() const { return NodeIt(v); }
-      NodeIt bNode() const { 
-	return (edge->_tail==v) ? NodeIt(edge->_head) : NodeIt(edge->_tail); }
+      NodeIt aNode() const { return NodeIt(edge->_head); }
+      NodeIt bNode() const { return NodeIt(edge->_tail); }
     };
 
@@ -445,20 +458,21 @@
       friend class ListGraph;
       bool out_or_in; //1 iff out, 0 iff in
-      node_item* v;
-    protected:
-      SymEdgeIt(const NodeIt& _v) : v(_v.node) { 
+      //node_item* v;
+    protected:
+      SymEdgeIt(const NodeIt& _v) /*: v(_v.node)*/ { 
 	out_or_in=1;
-	edge=v->_first_out_edge; 
-	if (!edge) { edge=v->_first_in_edge; out_or_in=0; }
+	edge=_v.node->_first_out_edge; 
+	if (!edge) { edge=_v.node->_first_in_edge; out_or_in=0; }
       }
     public:
-      SymEdgeIt() : EdgeIt(), v(0) { }
-      SymEdgeIt(const ListGraph& G, NodeIt _v) : v(_v.node) { 
+      SymEdgeIt() : EdgeIt() /*, v(0)*/ { }
+      SymEdgeIt(const ListGraph& G, NodeIt _v) /*: v(_v.node)*/ { 
 	out_or_in=1;
-	edge=v->_first_out_edge; 
-	if (!edge) { edge=v->_first_in_edge; out_or_in=0; }
+	edge=_v.node->_first_out_edge; 
+	if (!edge) { edge=_v.node->_first_in_edge; out_or_in=0; }
       }
       SymEdgeIt& operator++() { 
 	if (out_or_in) { 
+	  node_item* v=edge->_tail;
 	  edge=edge->_next_out; 
 	  if (!edge) { out_or_in=0; edge=v->_first_in_edge; }
@@ -469,7 +483,8 @@
       }
     protected:
-      NodeIt aNode() const { return NodeIt(v); }
+      NodeIt aNode() const { 
+	return (out_or_in) ? NodeIt(edge->_tail) : NodeIt(edge->_head); }
       NodeIt bNode() const { 
-	return (edge->_tail==v) ? NodeIt(edge->_head) : NodeIt(edge->_tail); }
+	return (out_or_in) ? NodeIt(edge->_head) : NodeIt(edge->_tail); }
     };
 
