Index: lemon/bits/graph_extender.h
===================================================================
--- lemon/bits/graph_extender.h	(revision 78)
+++ lemon/bits/graph_extender.h	(revision 57)
@@ -21,5 +21,4 @@
 
 #include <lemon/bits/invalid.h>
-#include <lemon/bits/utility.h>
 
 #include <lemon/bits/map_extender.h>
@@ -65,9 +64,9 @@
     }
 
-    Node oppositeNode(const Node &node, const Arc &arc) const {
-      if (node == Parent::source(arc))
-	return Parent::target(arc);
-      else if(node == Parent::target(arc))
-	return Parent::source(arc);
+    Node oppositeNode(const Node &n, const Arc &e) const {
+      if (n == Parent::source(e))
+	return Parent::target(e);
+      else if(n==Parent::target(e))
+	return Parent::source(e);
       else
 	return INVALID;
@@ -96,5 +95,5 @@
 
     class NodeIt : public Node { 
-      const Digraph* _digraph;
+      const Digraph* digraph;
     public:
 
@@ -103,13 +102,13 @@
       NodeIt(Invalid i) : Node(i) { }
 
-      explicit NodeIt(const Digraph& digraph) : _digraph(&digraph) {
-	_digraph->first(static_cast<Node&>(*this));
-      }
-
-      NodeIt(const Digraph& digraph, const Node& node) 
-	: Node(node), _digraph(&digraph) {}
+      explicit NodeIt(const Digraph& _digraph) : digraph(&_digraph) {
+	_digraph.first(static_cast<Node&>(*this));
+      }
+
+      NodeIt(const Digraph& _digraph, const Node& node) 
+	: Node(node), digraph(&_digraph) {}
 
       NodeIt& operator++() { 
-	_digraph->next(*this);
+	digraph->next(*this);
 	return *this; 
       }
@@ -119,5 +118,5 @@
 
     class ArcIt : public Arc { 
-      const Digraph* _digraph;
+      const Digraph* digraph;
     public:
 
@@ -126,13 +125,13 @@
       ArcIt(Invalid i) : Arc(i) { }
 
-      explicit ArcIt(const Digraph& digraph) : _digraph(&digraph) {
-	_digraph->first(static_cast<Arc&>(*this));
-      }
-
-      ArcIt(const Digraph& digraph, const Arc& arc) : 
-	Arc(arc), _digraph(&digraph) { }
+      explicit ArcIt(const Digraph& _digraph) : digraph(&_digraph) {
+	_digraph.first(static_cast<Arc&>(*this));
+      }
+
+      ArcIt(const Digraph& _digraph, const Arc& e) : 
+	Arc(e), digraph(&_digraph) { }
 
       ArcIt& operator++() { 
-	_digraph->next(*this);
+	digraph->next(*this);
 	return *this; 
       }
@@ -142,5 +141,5 @@
 
     class OutArcIt : public Arc { 
-      const Digraph* _digraph;
+      const Digraph* digraph;
     public:
 
@@ -149,14 +148,14 @@
       OutArcIt(Invalid i) : Arc(i) { }
 
-      OutArcIt(const Digraph& digraph, const Node& node) 
-	: _digraph(&digraph) {
-	_digraph->firstOut(*this, node);
-      }
-
-      OutArcIt(const Digraph& digraph, const Arc& arc) 
-	: Arc(arc), _digraph(&digraph) {}
+      OutArcIt(const Digraph& _digraph, const Node& node) 
+	: digraph(&_digraph) {
+	_digraph.firstOut(*this, node);
+      }
+
+      OutArcIt(const Digraph& _digraph, const Arc& arc) 
+	: Arc(arc), digraph(&_digraph) {}
 
       OutArcIt& operator++() { 
-	_digraph->nextOut(*this);
+	digraph->nextOut(*this);
 	return *this; 
       }
@@ -166,5 +165,5 @@
 
     class InArcIt : public Arc { 
-      const Digraph* _digraph;
+      const Digraph* digraph;
     public:
 
@@ -173,14 +172,14 @@
       InArcIt(Invalid i) : Arc(i) { }
 
-      InArcIt(const Digraph& digraph, const Node& node) 
-	: _digraph(&digraph) {
-	_digraph->firstIn(*this, node);
-      }
-
-      InArcIt(const Digraph& digraph, const Arc& arc) : 
-	Arc(arc), _digraph(&digraph) {}
+      InArcIt(const Digraph& _digraph, const Node& node) 
+	: digraph(&_digraph) {
+	_digraph.firstIn(*this, node);
+      }
+
+      InArcIt(const Digraph& _digraph, const Arc& arc) : 
+	Arc(arc), digraph(&_digraph) {}
 
       InArcIt& operator++() { 
-	_digraph->nextIn(*this);
+	digraph->nextIn(*this);
 	return *this; 
       }
@@ -191,6 +190,6 @@
     ///
     /// Returns the base node (i.e. the source in this case) of the iterator
-    Node baseNode(const OutArcIt &arc) const {
-      return Parent::source(arc);
+    Node baseNode(const OutArcIt &e) const {
+      return Parent::source(e);
     }
     /// \brief Running node of the iterator
@@ -198,6 +197,6 @@
     /// Returns the running node (i.e. the target in this case) of the
     /// iterator
-    Node runningNode(const OutArcIt &arc) const {
-      return Parent::target(arc);
+    Node runningNode(const OutArcIt &e) const {
+      return Parent::target(e);
     }
 
@@ -205,6 +204,6 @@
     ///
     /// Returns the base node (i.e. the target in this case) of the iterator
-    Node baseNode(const InArcIt &arc) const {
-      return Parent::target(arc);
+    Node baseNode(const InArcIt &e) const {
+      return Parent::target(e);
     }
     /// \brief Running node of the iterator
@@ -212,6 +211,6 @@
     /// Returns the running node (i.e. the source in this case) of the
     /// iterator
-    Node runningNode(const InArcIt &arc) const {
-      return Parent::source(arc);
+    Node runningNode(const InArcIt &e) const {
+      return Parent::source(e);
     }
 
@@ -325,5 +324,5 @@
   };
 
-  /// \ingroup _graphbits
+  /// \ingroup graphbits
   ///
   /// \brief Extender for the Graphs
@@ -333,7 +332,5 @@
     
     typedef Base Parent;
-    typedef GraphExtender Graph;
-
-    typedef True UndirectedTag;
+    typedef GraphExtender Digraph;
 
     typedef typename Parent::Node Node;
@@ -376,11 +373,11 @@
     }
 
-    Arc oppositeArc(const Arc &arc) const {
-      return Parent::direct(arc, !Parent::direction(arc));
+    Arc oppositeArc(const Arc &e) const {
+      return Parent::direct(e, !Parent::direction(e));
     }
 
     using Parent::direct;
-    Arc direct(const Edge &edge, const Node &node) const {
-      return Parent::direct(edge, Parent::source(edge) == node);
+    Arc direct(const Edge &ue, const Node &s) const {
+      return Parent::direct(ue, Parent::source(ue) == s);
     }
 
@@ -415,5 +412,5 @@
 
     class NodeIt : public Node { 
-      const Graph* _graph;
+      const Digraph* digraph;
     public:
 
@@ -422,13 +419,13 @@
       NodeIt(Invalid i) : Node(i) { }
 
-      explicit NodeIt(const Graph& graph) : _graph(&graph) {
-	_graph->first(static_cast<Node&>(*this));
-      }
-
-      NodeIt(const Graph& graph, const Node& node) 
-	: Node(node), _graph(&graph) {}
+      explicit NodeIt(const Digraph& _digraph) : digraph(&_digraph) {
+	_digraph.first(static_cast<Node&>(*this));
+      }
+
+      NodeIt(const Digraph& _digraph, const Node& node) 
+	: Node(node), digraph(&_digraph) {}
 
       NodeIt& operator++() { 
-	_graph->next(*this);
+	digraph->next(*this);
 	return *this; 
       }
@@ -438,5 +435,5 @@
 
     class ArcIt : public Arc { 
-      const Graph* _graph;
+      const Digraph* digraph;
     public:
 
@@ -445,13 +442,13 @@
       ArcIt(Invalid i) : Arc(i) { }
 
-      explicit ArcIt(const Graph& graph) : _graph(&graph) {
-	_graph->first(static_cast<Arc&>(*this));
-      }
-
-      ArcIt(const Graph& graph, const Arc& arc) : 
-	Arc(arc), _graph(&graph) { }
+      explicit ArcIt(const Digraph& _digraph) : digraph(&_digraph) {
+	_digraph.first(static_cast<Arc&>(*this));
+      }
+
+      ArcIt(const Digraph& _digraph, const Arc& e) : 
+	Arc(e), digraph(&_digraph) { }
 
       ArcIt& operator++() { 
-	_graph->next(*this);
+	digraph->next(*this);
 	return *this; 
       }
@@ -461,5 +458,5 @@
 
     class OutArcIt : public Arc { 
-      const Graph* _graph;
+      const Digraph* digraph;
     public:
 
@@ -468,14 +465,14 @@
       OutArcIt(Invalid i) : Arc(i) { }
 
-      OutArcIt(const Graph& graph, const Node& node) 
-	: _graph(&graph) {
-	_graph->firstOut(*this, node);
-      }
-
-      OutArcIt(const Graph& graph, const Arc& arc) 
-	: Arc(arc), _graph(&graph) {}
+      OutArcIt(const Digraph& _digraph, const Node& node) 
+	: digraph(&_digraph) {
+	_digraph.firstOut(*this, node);
+      }
+
+      OutArcIt(const Digraph& _digraph, const Arc& arc) 
+	: Arc(arc), digraph(&_digraph) {}
 
       OutArcIt& operator++() { 
-	_graph->nextOut(*this);
+	digraph->nextOut(*this);
 	return *this; 
       }
@@ -485,5 +482,5 @@
 
     class InArcIt : public Arc { 
-      const Graph* _graph;
+      const Digraph* digraph;
     public:
 
@@ -492,14 +489,14 @@
       InArcIt(Invalid i) : Arc(i) { }
 
-      InArcIt(const Graph& graph, const Node& node) 
-	: _graph(&graph) {
-	_graph->firstIn(*this, node);
-      }
-
-      InArcIt(const Graph& graph, const Arc& arc) : 
-	Arc(arc), _graph(&graph) {}
+      InArcIt(const Digraph& _digraph, const Node& node) 
+	: digraph(&_digraph) {
+	_digraph.firstIn(*this, node);
+      }
+
+      InArcIt(const Digraph& _digraph, const Arc& arc) : 
+	Arc(arc), digraph(&_digraph) {}
 
       InArcIt& operator++() { 
-	_graph->nextIn(*this);
+	digraph->nextIn(*this);
 	return *this; 
       }
@@ -509,5 +506,5 @@
 
     class EdgeIt : public Parent::Edge { 
-      const Graph* _graph;
+      const Digraph* digraph;
     public:
 
@@ -516,39 +513,39 @@
       EdgeIt(Invalid i) : Edge(i) { }
 
-      explicit EdgeIt(const Graph& graph) : _graph(&graph) {
-	_graph->first(static_cast<Edge&>(*this));
-      }
-
-      EdgeIt(const Graph& graph, const Edge& edge) : 
-	Edge(edge), _graph(&graph) { }
+      explicit EdgeIt(const Digraph& _digraph) : digraph(&_digraph) {
+	_digraph.first(static_cast<Edge&>(*this));
+      }
+
+      EdgeIt(const Digraph& _digraph, const Edge& e) : 
+	Edge(e), digraph(&_digraph) { }
 
       EdgeIt& operator++() { 
-	_graph->next(*this);
-	return *this; 
-      }
-
-    };
-
-    class IncEdgeIt : public Parent::Edge {
+	digraph->next(*this);
+	return *this; 
+      }
+
+    };
+
+    class IncArcIt : public Parent::Edge {
       friend class GraphExtender;
-      const Graph* _graph;
-      bool _direction;
-    public:
-
-      IncEdgeIt() { }
-
-      IncEdgeIt(Invalid i) : Edge(i), _direction(false) { }
-
-      IncEdgeIt(const Graph& graph, const Node &node) : _graph(&graph) {
-	_graph->firstInc(*this, _direction, node);
-      }
-
-      IncEdgeIt(const Graph& graph, const Edge &edge, const Node &node)
-	: _graph(&graph), Edge(edge) {
-	_direction = (_graph->source(edge) == node);
-      }
-
-      IncEdgeIt& operator++() {
-	_graph->nextInc(*this, _direction);
+      const Digraph* digraph;
+      bool direction;
+    public:
+
+      IncArcIt() { }
+
+      IncArcIt(Invalid i) : Edge(i), direction(false) { }
+
+      IncArcIt(const Digraph& _digraph, const Node &n) : digraph(&_digraph) {
+	_digraph.firstInc(*this, direction, n);
+      }
+
+      IncArcIt(const Digraph& _digraph, const Edge &ue, const Node &n)
+	: digraph(&_digraph), Edge(ue) {
+	direction = (_digraph.source(ue) == n);
+      }
+
+      IncArcIt& operator++() {
+	digraph->nextInc(*this, direction);
 	return *this; 
       }
@@ -558,6 +555,6 @@
     ///
     /// Returns the base node (ie. the source in this case) of the iterator
-    Node baseNode(const OutArcIt &arc) const {
-      return Parent::source(static_cast<const Arc&>(arc));
+    Node baseNode(const OutArcIt &e) const {
+      return Parent::source(static_cast<const Arc&>(e));
     }
     /// \brief Running node of the iterator
@@ -565,6 +562,6 @@
     /// Returns the running node (ie. the target in this case) of the
     /// iterator
-    Node runningNode(const OutArcIt &arc) const {
-      return Parent::target(static_cast<const Arc&>(arc));
+    Node runningNode(const OutArcIt &e) const {
+      return Parent::target(static_cast<const Arc&>(e));
     }
 
@@ -572,6 +569,6 @@
     ///
     /// Returns the base node (ie. the target in this case) of the iterator
-    Node baseNode(const InArcIt &arc) const {
-      return Parent::target(static_cast<const Arc&>(arc));
+    Node baseNode(const InArcIt &e) const {
+      return Parent::target(static_cast<const Arc&>(e));
     }
     /// \brief Running node of the iterator
@@ -579,6 +576,6 @@
     /// Returns the running node (ie. the source in this case) of the
     /// iterator
-    Node runningNode(const InArcIt &arc) const {
-      return Parent::source(static_cast<const Arc&>(arc));
+    Node runningNode(const InArcIt &e) const {
+      return Parent::source(static_cast<const Arc&>(e));
     }
 
@@ -586,12 +583,12 @@
     ///
     /// Returns the base node of the iterator
-    Node baseNode(const IncEdgeIt &edge) const {
-      return edge._direction ? source(edge) : target(edge);
+    Node baseNode(const IncArcIt &e) const {
+      return e.direction ? source(e) : target(e);
     }
     /// Running node of the iterator
     ///
     /// Returns the running node of the iterator
-    Node runningNode(const IncEdgeIt &edge) const {
-      return edge._direction ? target(edge) : source(edge);
+    Node runningNode(const IncArcIt &e) const {
+      return e.direction ? target(e) : source(e);
     }
 
@@ -600,13 +597,13 @@
     template <typename _Value>
     class NodeMap 
-      : public MapExtender<DefaultMap<Graph, Node, _Value> > {
-    public:
-      typedef GraphExtender Graph;
-      typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent;
-
-      NodeMap(const Graph& graph) 
-	: Parent(graph) {}
-      NodeMap(const Graph& graph, const _Value& value) 
-	: Parent(graph, value) {}
+      : public MapExtender<DefaultMap<Digraph, Node, _Value> > {
+    public:
+      typedef GraphExtender Digraph;
+      typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent;
+
+      NodeMap(const Digraph& digraph) 
+	: Parent(digraph) {}
+      NodeMap(const Digraph& digraph, const _Value& value) 
+	: Parent(digraph, value) {}
 
       NodeMap& operator=(const NodeMap& cmap) {
@@ -624,13 +621,13 @@
     template <typename _Value>
     class ArcMap 
-      : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
-    public:
-      typedef GraphExtender Graph;
-      typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
-
-      ArcMap(const Graph& graph) 
-	: Parent(graph) {}
-      ArcMap(const Graph& graph, const _Value& value) 
-	: Parent(graph, value) {}
+      : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
+    public:
+      typedef GraphExtender Digraph;
+      typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
+
+      ArcMap(const Digraph& digraph) 
+	: Parent(digraph) {}
+      ArcMap(const Digraph& digraph, const _Value& value) 
+	: Parent(digraph, value) {}
 
       ArcMap& operator=(const ArcMap& cmap) {
@@ -648,14 +645,14 @@
     template <typename _Value>
     class EdgeMap 
-      : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
-    public:
-      typedef GraphExtender Graph;
-      typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
-
-      EdgeMap(const Graph& graph) 
-	: Parent(graph) {}
-
-      EdgeMap(const Graph& graph, const _Value& value) 
-	: Parent(graph, value) {}
+      : public MapExtender<DefaultMap<Digraph, Edge, _Value> > {
+    public:
+      typedef GraphExtender Digraph;
+      typedef MapExtender<DefaultMap<Digraph, Edge, _Value> > Parent;
+
+      EdgeMap(const Digraph& digraph) 
+	: Parent(digraph) {}
+
+      EdgeMap(const Digraph& digraph, const _Value& value) 
+	: Parent(digraph, value) {}
 
       EdgeMap& operator=(const EdgeMap& cmap) {
@@ -696,8 +693,8 @@
     }
 
-    template <typename Graph, typename NodeRefMap, typename EdgeRefMap>
-    void build(const Graph& graph, NodeRefMap& nodeRef, 
+    template <typename Digraph, typename NodeRefMap, typename EdgeRefMap>
+    void build(const Digraph& digraph, NodeRefMap& nodeRef, 
                EdgeRefMap& edgeRef) {
-      Parent::build(graph, nodeRef, edgeRef);
+      Parent::build(digraph, nodeRef, edgeRef);
       notifier(Node()).build();
       notifier(Edge()).build();
@@ -724,8 +721,8 @@
 
     void erase(const Edge& edge) {
-      std::vector<Arc> av;
-      av.push_back(Parent::direct(edge, true));
-      av.push_back(Parent::direct(edge, false));      
-      notifier(Arc()).erase(av);
+      std::vector<Arc> ev;
+      ev.push_back(Parent::direct(edge, true));
+      ev.push_back(Parent::direct(edge, false));      
+      notifier(Arc()).erase(ev);
       notifier(Edge()).erase(edge);
       Parent::erase(edge);
Index: lemon/bits/path_dump.h
===================================================================
--- lemon/bits/path_dump.h	(revision 100)
+++ lemon/bits/path_dump.h	(revision 100)
@@ -0,0 +1,174 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_PRED_MAP_PATH_H
+#define LEMON_BITS_PRED_MAP_PATH_H
+
+namespace lemon {
+
+  template <typename _Digraph, typename _PredMap>
+  class PredMapPath {
+  public:
+    typedef True RevPathTag;
+
+    typedef _Digraph Digraph;
+    typedef typename Digraph::Arc Arc;
+    typedef _PredMap PredMap;
+
+    PredMapPath(const Digraph& _digraph, const PredMap& _predMap,
+                typename Digraph::Node _target)
+      : digraph(_digraph), predMap(_predMap), target(_target) {}
+
+    int length() const {
+      int len = 0;
+      typename Digraph::Node node = target;
+      typename Digraph::Arc arc;
+      while ((arc = predMap[node]) != INVALID) {
+        node = digraph.source(arc);
+        ++len;
+      }
+      return len;
+    }
+
+    bool empty() const {
+      return predMap[target] != INVALID;
+    }
+
+    class RevArcIt {
+    public:
+      RevArcIt() {}
+      RevArcIt(Invalid) : path(0), current(INVALID) {}
+      RevArcIt(const PredMapPath& _path) 
+        : path(&_path), current(_path.target) {
+        if (path->predMap[current] == INVALID) current = INVALID;
+      }
+
+      operator const typename Digraph::Arc() const {
+        return path->predMap[current];
+      }
+
+      RevArcIt& operator++() {
+        current = path->digraph.source(path->predMap[current]);
+        if (path->predMap[current] == INVALID) current = INVALID;
+        return *this;
+      }
+
+      bool operator==(const RevArcIt& e) const { 
+        return current == e.current; 
+      }
+
+      bool operator!=(const RevArcIt& e) const {
+        return current != e.current; 
+      }
+
+      bool operator<(const RevArcIt& e) const { 
+        return current < e.current; 
+      }
+      
+    private:
+      const PredMapPath* path;
+      typename Digraph::Node current;
+    };
+
+  private:
+    const Digraph& digraph;
+    const PredMap& predMap;
+    typename Digraph::Node target;
+  };
+
+
+  template <typename _Digraph, typename _PredMatrixMap>
+  class PredMatrixMapPath {
+  public:
+    typedef True RevPathTag;
+
+    typedef _Digraph Digraph;
+    typedef typename Digraph::Arc Arc;
+    typedef _PredMatrixMap PredMatrixMap;
+
+    PredMatrixMapPath(const Digraph& _digraph, 
+                      const PredMatrixMap& _predMatrixMap,
+                      typename Digraph::Node _source, 
+                      typename Digraph::Node _target)
+      : digraph(_digraph), predMatrixMap(_predMatrixMap), 
+        source(_source), target(_target) {}
+
+    int length() const {
+      int len = 0;
+      typename Digraph::Node node = target;
+      typename Digraph::Arc arc;
+      while ((arc = predMatrixMap(source, node)) != INVALID) {
+        node = digraph.source(arc);
+        ++len;
+      }
+      return len;
+    }
+
+    bool empty() const {
+      return source != target;
+    }
+
+    class RevArcIt {
+    public:
+      RevArcIt() {}
+      RevArcIt(Invalid) : path(0), current(INVALID) {}
+      RevArcIt(const PredMatrixMapPath& _path) 
+        : path(&_path), current(_path.target) {
+        if (path->predMatrixMap(path->source, current) == INVALID) 
+          current = INVALID;
+      }
+
+      operator const typename Digraph::Arc() const {
+        return path->predMatrixMap(path->source, current);
+      }
+
+      RevArcIt& operator++() {
+        current = 
+          path->digraph.source(path->predMatrixMap(path->source, current));
+        if (path->predMatrixMap(path->source, current) == INVALID) 
+          current = INVALID;
+        return *this;
+      }
+
+      bool operator==(const RevArcIt& e) const { 
+        return current == e.current; 
+      }
+
+      bool operator!=(const RevArcIt& e) const {
+        return current != e.current; 
+      }
+
+      bool operator<(const RevArcIt& e) const { 
+        return current < e.current; 
+      }
+      
+    private:
+      const PredMatrixMapPath* path;
+      typename Digraph::Node current;
+    };
+
+  private:
+    const Digraph& digraph;
+    const PredMatrixMap& predMatrixMap;
+    typename Digraph::Node source;
+    typename Digraph::Node target;
+  };
+
+}
+
+#endif
