Index: AUTHORS
===================================================================
--- AUTHORS	(revision 320)
+++ AUTHORS	(revision 1072)
@@ -24,3 +24,3 @@
 
 Again, please visit the history of the old LEMON repository for more
-details: http://lemon.cs.elte.hu/svn/lemon/trunk
+details: http://lemon.cs.elte.hu/hg/lemon-0.x
Index: doc/lgf.dox
===================================================================
--- doc/lgf.dox	(revision 463)
+++ doc/lgf.dox	(revision 1069)
@@ -64,9 +64,9 @@
 \endcode
 
-The \c \@arcs section is very similar to the \c \@nodes section,
-it again starts with a header line describing the names of the maps,
-but the \c "label" map is not obligatory here. The following lines
-describe the arcs. The first two tokens of each line are
-the source and the target node of the arc, respectively, then come the map
+The \c \@arcs section is very similar to the \c \@nodes section, it
+again starts with a header line describing the names of the maps, but
+the \c "label" map is not obligatory here. The following lines
+describe the arcs. The first two tokens of each line are the source
+and the target node of the arc, respectively, then come the map
 values. The source and target tokens must be node labels.
 
@@ -79,8 +79,19 @@
 \endcode
 
+If there is no map in the \c \@arcs section at all, then it must be
+indicated by a sole '-' sign in the first line.
+
+\code
+ @arcs
+         -
+ 1   2
+ 1   3
+ 2   3
+\endcode
+
 The \c \@edges is just a synonym of \c \@arcs. The \@arcs section can
 also store the edge set of an undirected graph. In such case there is
 a conventional method for store arc maps in the file, if two columns
-has the same caption with \c '+' and \c '-' prefix, then these columns
+have the same caption with \c '+' and \c '-' prefix, then these columns
 can be regarded as the values of an arc map.
 
Index: lemon/Makefile.am
===================================================================
--- lemon/Makefile.am	(revision 728)
+++ lemon/Makefile.am	(revision 1102)
@@ -1,4 +1,5 @@
 EXTRA_DIST += \
 	lemon/lemon.pc.in \
+	lemon/lemon.pc.cmake \
 	lemon/CMakeLists.txt \
 	lemon/config.h.cmake
Index: lemon/bits/path_dump.h
===================================================================
--- lemon/bits/path_dump.h	(revision 576)
+++ lemon/bits/path_dump.h	(revision 973)
@@ -50,5 +50,5 @@
 
     bool empty() const {
-      return predMap[target] != INVALID;
+      return predMap[target] == INVALID;
     }
 
@@ -124,5 +124,5 @@
 
     bool empty() const {
-      return source != target;
+      return predMatrixMap(source, target) == INVALID;
     }
 
Index: lemon/core.h
===================================================================
--- lemon/core.h	(revision 718)
+++ lemon/core.h	(revision 984)
@@ -395,4 +395,5 @@
       static void copy(const From& from, Digraph &to,
                        NodeRefMap& nodeRefMap, ArcRefMap& arcRefMap) {
+        to.clear();
         for (typename From::NodeIt it(from); it != INVALID; ++it) {
           nodeRefMap[it] = to.addNode();
@@ -422,4 +423,5 @@
       static void copy(const From& from, Graph &to,
                        NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
+        to.clear();
         for (typename From::NodeIt it(from); it != INVALID; ++it) {
           nodeRefMap[it] = to.addNode();
Index: lemon/dfs.h
===================================================================
--- lemon/dfs.h	(revision 631)
+++ lemon/dfs.h	(revision 1009)
@@ -558,5 +558,5 @@
     void start(Node t)
     {
-      while ( !emptyQueue() && G->target(_stack[_stack_head])!=t )
+      while ( !emptyQueue() && !(*_reached)[t] )
         processNextArc();
     }
@@ -1510,5 +1510,5 @@
     /// with addSource() before using this function.
     void start(Node t) {
-      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t )
+      while ( !emptyQueue() && !(*_reached)[t] )
         processNextArc();
     }
Index: lemon/graph_to_eps.h
===================================================================
--- lemon/graph_to_eps.h	(revision 664)
+++ lemon/graph_to_eps.h	(revision 908)
@@ -685,7 +685,7 @@
 #else
       os << bits::getWinFormattedDate();
+      os << std::endl;
 #endif
     }
-    os << std::endl;
 
     if (_autoArcWidthScale) {
Index: lemon/lgf_reader.h
===================================================================
--- lemon/lgf_reader.h	(revision 646)
+++ lemon/lgf_reader.h	(revision 1069)
@@ -3,5 +3,5 @@
  * This file is a part of LEMON, a generic C++ optimization library.
  *
- * Copyright (C) 2003-2009
+ * Copyright (C) 2003-2011
  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
  * (Egervary Research Group on Combinatorial Optimization, EGRES).
@@ -965,4 +965,11 @@
         int index = 0;
         while (_reader_bits::readToken(line, map)) {
+          if(map == "-") {
+              if(index!=0)
+                throw FormatError("'-' is not allowed as a map name");
+              else if (line >> std::ws >> c)
+                throw FormatError("Extra character at the end of line");
+              else break;
+            }
           if (maps.find(map) != maps.end()) {
             std::ostringstream msg;
@@ -1835,4 +1842,11 @@
         int index = 0;
         while (_reader_bits::readToken(line, map)) {
+          if(map == "-") {
+              if(index!=0)
+                throw FormatError("'-' is not allowed as a map name");
+              else if (line >> std::ws >> c)
+                throw FormatError("Extra character at the end of line");
+              else break;
+            }
           if (maps.find(map) != maps.end()) {
             std::ostringstream msg;
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt	(revision 1061)
+++ test/CMakeLists.txt	(revision 1069)
@@ -32,4 +32,5 @@
   heap_test
   kruskal_test
+  lgf_test
   maps_test
   matching_test
Index: test/Makefile.am
===================================================================
--- test/Makefile.am	(revision 696)
+++ test/Makefile.am	(revision 1102)
@@ -26,4 +26,5 @@
 	test/heap_test \
 	test/kruskal_test \
+	test/lgf_test \
 	test/maps_test \
 	test/matching_test \
@@ -71,4 +72,5 @@
 test_kruskal_test_SOURCES = test/kruskal_test.cc
 test_hao_orlin_test_SOURCES = test/hao_orlin_test.cc
+test_lgf_test_SOURCES = test/lgf_test.cc
 test_lp_test_SOURCES = test/lp_test.cc
 test_maps_test_SOURCES = test/maps_test.cc
Index: test/dfs_test.cc
===================================================================
--- test/dfs_test.cc	(revision 632)
+++ test/dfs_test.cc	(revision 1009)
@@ -51,5 +51,8 @@
   "@attributes\n"
   "source 0\n"
-  "target 5\n";
+  "target 5\n"
+  "source1 6\n"
+  "target1 3\n";
+
 
 void checkDfsCompile()
@@ -180,4 +183,5 @@
   Digraph G;
   Node s, t;
+  Node s1, t1;
 
   std::istringstream input(test_lgf);
@@ -185,4 +189,6 @@
     node("source", s).
     node("target", t).
+    node("source1", s1).
+    node("target1", t1).
     run();
 
@@ -211,4 +217,9 @@
 
   {
+  Dfs<Digraph> dfs(G);
+  check(dfs.run(s1,t1) && dfs.reached(t1),"Node 3 is reachable from Node 6.");
+  }
+  
+  {
     NullMap<Node,Arc> myPredMap;
     dfs(G).predMap(myPredMap).run(s);
Index: test/graph_copy_test.cc
===================================================================
--- test/graph_copy_test.cc	(revision 463)
+++ test/graph_copy_test.cc	(revision 984)
@@ -30,4 +30,5 @@
   const int nn = 10;
 
+  // Build a digraph
   SmartDigraph from;
   SmartDigraph::NodeMap<int> fnm(from);
@@ -52,4 +53,5 @@
   }
 
+  // Test digraph copy
   ListDigraph to;
   ListDigraph::NodeMap<int> tnm(to);
@@ -69,4 +71,7 @@
     nodeCrossRef(ncr).arcCrossRef(ecr).
     node(fn, tn).arc(fa, ta).run();
+  
+  check(countNodes(from) == countNodes(to), "Wrong copy.");
+  check(countArcs(from) == countArcs(to), "Wrong copy.");
 
   for (SmartDigraph::NodeIt it(from); it != INVALID; ++it) {
@@ -91,4 +96,10 @@
   check(tn == nr[fn], "Wrong copy.");
   check(ta == er[fa], "Wrong copy.");
+
+  // Test repeated copy
+  digraphCopy(from, to).run();
+  
+  check(countNodes(from) == countNodes(to), "Wrong copy.");
+  check(countArcs(from) == countArcs(to), "Wrong copy.");
 }
 
@@ -96,4 +107,5 @@
   const int nn = 10;
 
+  // Build a graph
   SmartGraph from;
   SmartGraph::NodeMap<int> fnm(from);
@@ -123,4 +135,5 @@
   }
 
+  // Test graph copy
   ListGraph to;
   ListGraph::NodeMap<int> tnm(to);
@@ -144,4 +157,8 @@
     nodeCrossRef(ncr).arcCrossRef(acr).edgeCrossRef(ecr).
     node(fn, tn).arc(fa, ta).edge(fe, te).run();
+
+  check(countNodes(from) == countNodes(to), "Wrong copy.");
+  check(countEdges(from) == countEdges(to), "Wrong copy.");
+  check(countArcs(from) == countArcs(to), "Wrong copy.");
 
   for (SmartGraph::NodeIt it(from); it != INVALID; ++it) {
@@ -181,4 +198,11 @@
   check(ta == ar[fa], "Wrong copy.");
   check(te == er[fe], "Wrong copy.");
+
+  // Test repeated copy
+  graphCopy(from, to).run();
+  
+  check(countNodes(from) == countNodes(to), "Wrong copy.");
+  check(countEdges(from) == countEdges(to), "Wrong copy.");
+  check(countArcs(from) == countArcs(to), "Wrong copy.");
 }
 
Index: test/lgf_test.cc
===================================================================
--- test/lgf_test.cc	(revision 1087)
+++ test/lgf_test.cc	(revision 1087)
@@ -0,0 +1,169 @@
+/* -*- mode: C++; indent-tabs-mode: nil; -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library.
+ *
+ * Copyright (C) 2003-2011
+ * 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.
+ *
+ */
+
+#include <lemon/list_graph.h>
+#include <lemon/lgf_reader.h>
+#include "test_tools.h"
+
+using namespace lemon;
+
+char test_lgf[] =
+  "@nodes\n"
+  "label\n"
+  "0\n"
+  "1\n"
+  "@arcs\n"
+  "     label\n"
+  "0 1  0\n"
+  "1 0  1\n"
+  "@attributes\n"
+  "source 0\n"
+  "target 1\n";
+
+char test_lgf_nomap[] =
+  "@nodes\n"
+  "label\n"
+  "0\n"
+  "1\n"
+  "@arcs\n"
+  "     -\n"
+  "0 1\n";
+
+char test_lgf_bad1[] =
+  "@nodes\n"
+  "label\n"
+  "0\n"
+  "1\n"
+  "@arcs\n"
+  "     - another\n"
+  "0 1\n";
+
+char test_lgf_bad2[] =
+  "@nodes\n"
+  "label\n"
+  "0\n"
+  "1\n"
+  "@arcs\n"
+  "     label -\n"
+  "0 1\n";
+
+
+int main() 
+{
+  {
+    ListDigraph d; 
+    ListDigraph::Node s,t;
+    ListDigraph::ArcMap<int> label(d);
+    std::istringstream input(test_lgf);
+    digraphReader(d, input).
+      node("source", s).
+      node("target", t).
+      arcMap("label", label).
+      run();
+    check(countNodes(d) == 2,"There should be 2 nodes");
+    check(countArcs(d) == 2,"There should be 2 arcs");
+  }
+  {
+    ListGraph g;
+    ListGraph::Node s,t;
+    ListGraph::EdgeMap<int> label(g);
+    std::istringstream input(test_lgf);
+    graphReader(g, input).
+      node("source", s).
+      node("target", t).
+      edgeMap("label", label).
+      run();
+    check(countNodes(g) == 2,"There should be 2 nodes");
+    check(countEdges(g) == 2,"There should be 2 arcs");
+  }
+
+  {
+    ListDigraph d; 
+    std::istringstream input(test_lgf_nomap);
+    digraphReader(d, input).
+      run();
+    check(countNodes(d) == 2,"There should be 2 nodes");
+    check(countArcs(d) == 1,"There should be 1 arc");
+  }
+  {
+    ListGraph g;
+    std::istringstream input(test_lgf_nomap);
+    graphReader(g, input).
+      run();
+    check(countNodes(g) == 2,"There should be 2 nodes");
+    check(countEdges(g) == 1,"There should be 1 edge");
+  }
+
+  {
+    ListDigraph d; 
+    std::istringstream input(test_lgf_bad1);
+    bool ok=false;
+    try {
+      digraphReader(d, input).
+        run();
+    }
+    catch (FormatError&) 
+      {
+        ok = true;
+      }
+    check(ok,"FormatError exception should have occured");
+  }
+  {
+    ListGraph g;
+    std::istringstream input(test_lgf_bad1);
+    bool ok=false;
+    try {
+      graphReader(g, input).
+        run();
+    }
+    catch (FormatError&)
+      {
+        ok = true;
+      }
+    check(ok,"FormatError exception should have occured");
+  }
+
+  {
+    ListDigraph d; 
+    std::istringstream input(test_lgf_bad2);
+    bool ok=false;
+    try {
+      digraphReader(d, input).
+        run();
+    }
+    catch (FormatError&)
+      {
+        ok = true;
+      }
+    check(ok,"FormatError exception should have occured");
+  }
+  {
+    ListGraph g;
+    std::istringstream input(test_lgf_bad2);
+    bool ok=false;
+    try {
+      graphReader(g, input).
+        run();
+    }
+    catch (FormatError&)
+      {
+        ok = true;
+      }
+    check(ok,"FormatError exception should have occured");
+  }
+}
