Index: tools/lgf-gen.cc
===================================================================
--- tools/lgf-gen.cc	(revision 2391)
+++ tools/lgf-gen.cc	(revision 2402)
@@ -30,4 +30,5 @@
 #include <algorithm>
 #include <lemon/unionfind.h>
+#include <lemon/time_measure.h>
 
 using namespace lemon;
@@ -37,6 +38,8 @@
 UGRAPH_TYPEDEFS(ListUGraph);
 
+bool progress=true;
+
 int N;
-int girth;
+// int girth;
 
 ListUGraph g;
@@ -235,29 +238,42 @@
 
 void minTree() {
+  int en=0;
+  int pr=0;
   std::vector<Pedge> pedges;
+  Timer T;
+  std::cout << T.realTime() << "s: Setting up the edges...\n";
   for(NodeIt n(g);n!=INVALID;++n) 
-    for(NodeIt m=++(NodeIt(n));m!=INVALID;++m)
-      {
-	Pedge p;
-	p.a=n;
-	p.b=m;
-	p.len=(coords[m]-coords[n]).normSquare();
-	pedges.push_back(p);
-      }
+    {
+      for(NodeIt m=++(NodeIt(n));m!=INVALID;++m)
+	{
+	  Pedge p;
+	  p.a=n;
+	  p.b=m;
+	  p.len=(coords[m]-coords[n]).normSquare();
+	  pedges.push_back(p);
+	}
+      en++;
+      if(progress && en>=pr*double(N)/100) 
+	{
+	  std::cout << pr << "%  \r" << std::flush;
+	  pr++;
+	}
+    }
+  std::cout << T.realTime() << "s: Sorting the edges...\n";
   std::sort(pedges.begin(),pedges.end(),pedgeLess);
+  std::cout << T.realTime() << "s: Creating the tree...\n";
   ListUGraph::NodeMap<int> comp(g);
   UnionFind<ListUGraph::NodeMap<int> > uf(comp);
   for (NodeIt it(g); it != INVALID; ++it)
-    uf.insert(it);
-
-  int en=0;
+    uf.insert(it);  
   for(std::vector<Pedge>::iterator pi=pedges.begin();pi!=pedges.end();++pi)
     {
       if ( uf.join(pi->a,pi->b) ) {
 	g.addEdge(pi->a,pi->b);
-	en++;
-	if(en>=N-1) return;
-      }
-    }
+	if(en>=N-1)
+	  break;
+      }
+    }
+  std::cout << T.realTime() << "s: Done\n";
 }
 
@@ -268,21 +284,21 @@
   ArgParser ap(argc,argv);
 
-  bool eps;
+//   bool eps;
   bool disc_d, square_d, gauss_d;
-  bool tsp_a,two_a,tree_a;
+//   bool tsp_a,two_a,tree_a;
   int num_of_cities=1;
   double area=1;
   N=100;
-  girth=10;
+//   girth=10;
   std::string ndist("disc");
-  ap.option("n", "Number of nodes (default is 100)", N)
-    .option("g", "Girth parameter (default is 10)", girth)
-    .option("cities", "Number of cities (default is 1)", num_of_cities)
-    .option("area", "Full relative area of the cities (default is 1)", area)
-    .option("disc", "Nodes are evenly distributed on a unit disc (default)",disc_d)
+  ap.refOption("n", "Number of nodes (default is 100)", N)
+    .intOption("g", "Girth parameter (default is 10)", 10)
+    .refOption("cities", "Number of cities (default is 1)", num_of_cities)
+    .refOption("area", "Full relative area of the cities (default is 1)", area)
+    .refOption("disc", "Nodes are evenly distributed on a unit disc (default)",disc_d)
     .optionGroup("dist", "disc")
-    .option("square", "Nodes are evenly distributed on a unit square", square_d)
+    .refOption("square", "Nodes are evenly distributed on a unit square", square_d)
     .optionGroup("dist", "square")
-    .option("gauss",
+    .refOption("gauss",
 	    "Nodes are located according to a two-dim gauss distribution",
 	    gauss_d)
@@ -290,10 +306,10 @@
 //     .mandatoryGroup("dist")
     .onlyOneGroup("dist")
-    .option("eps", "Also generate .eps output (prefix.eps)",eps)
-    .option("2con", "Create a two connected planar graph",two_a)
+    .boolOption("eps", "Also generate .eps output (prefix.eps)")
+    .boolOption("2con", "Create a two connected planar graph")
     .optionGroup("alg","2con")
-    .option("tree", "Create a min. cost spanning tree",tree_a)
+    .boolOption("tree", "Create a min. cost spanning tree")
     .optionGroup("alg","tree")
-    .option("tsp", "Create a TSP tour",tsp_a)
+    .boolOption("tsp", "Create a TSP tour")
     .optionGroup("alg","tsp")
     .onlyOneGroup("alg")
@@ -353,16 +369,16 @@
     }
   
-  if(tsp_a) {
+  if(ap["tsp"]) {
     tsp();
     std::cout << "#2-opt improvements: " << tsp_impr_num << std::endl;
   }
-  else if(two_a) {
+  else if(ap["2con"]) {
     std::cout << "Make triangles\n";
     //   triangle();
-    sparseTriangle(girth);
+    sparseTriangle(ap["g"]);
     std::cout << "Make it sparser\n";
-    sparse2(girth);
+    sparse2(ap["g"]);
   }
-  else if(tree_a) {
+  else if(ap["tree"]) {
     minTree();
   }
@@ -375,5 +391,5 @@
     tlen+=sqrt((coords[g.source(e)]-coords[g.target(e)]).normSquare());
   std::cout << "Total edge length  : " << tlen << std::endl;
-  if(eps)
+  if(ap["eps"])
     graphToEps(g,prefix+".eps").
       scale(600).nodeScale(.2).edgeWidthScale(.001).preScale(false).
