[Lemon-commits] [lemon_svn] deba: r2205 - hugo/trunk/demo

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:50:55 CET 2006


Author: deba
Date: Tue Sep 13 14:41:02 2005
New Revision: 2205

Added:
   hugo/trunk/demo/coloring.lgf
Modified:
   hugo/trunk/demo/coloring.cc

Log:
Input file for coloring.



Modified: hugo/trunk/demo/coloring.cc
==============================================================================
--- hugo/trunk/demo/coloring.cc	(original)
+++ hugo/trunk/demo/coloring.cc	Tue Sep 13 14:41:02 2005
@@ -28,18 +28,7 @@
 using namespace std;
 using namespace lemon;
 
-int main(int argc, char *argv[]) 
-{
-  if(argc<2)
-  {
-      std::cerr << "USAGE: coloring input_file.lgf" << std::endl;
-      std::cerr << "The file 'input_file.lgf' has to contain a graph in LEMON format together with a nodemap called 'coords' to draw the graph (e.g. sample.lgf is not such a file)." << std::endl;
-      return 0;
-  }
-
-
-  //input stream to read the graph from
-  std::ifstream is(argv[1]);
+int main() {
 
   typedef UndirSmartGraph Graph;
   typedef Graph::Node Node;
@@ -47,9 +36,13 @@
   typedef Graph::UndirEdge UndirEdge;
   typedef Graph::IncEdgeIt IncEdgeIt;
 
+  std::cout << "Six coloring of a plan graph" << std::endl;
+  std::cout << "Input file: coloring.lgf" << std::endl;
+  std::cout << "Output file: coloring.eps" << std::endl;
+
   Graph graph;
 
-  UndirGraphReader<Graph> reader(is, graph);
+  UndirGraphReader<Graph> reader("coloring.lgf", graph);
   Graph::NodeMap<xy<double> > coords(graph);
   reader.readNodeMap("coords", coords);
   
@@ -94,10 +87,10 @@
 
   ColorSet colorSet;
 
-  graphToEps(graph, "six_coloring.eps").
-    title("Six Colored Graph").copyright("(C) 2005 LEMON Project").
+  graphToEps(graph, "coloring.eps").
+    title("Six Colored Plan Graph").copyright("(C) 2005 LEMON Project").
     coords(coords).nodeColors(composeMap(colorSet, color)).
-    scaleToA4().run();
+    nodeScale(5.0).scaleToA4().run();
 
   return 0;
 }

Added: hugo/trunk/demo/coloring.lgf
==============================================================================
--- (empty file)
+++ hugo/trunk/demo/coloring.lgf	Tue Sep 13 14:41:02 2005
@@ -0,0 +1,36 @@
+ at nodeset 
+coords	id	
+(162, 142)	10	
+(169, -35)	9	
+(-154, -37)	8	
+(-1, 12)	7	
+(-87, -197)	6	
+(360, 54)	5	
+(193, 257)	4	
+(-89, 224)	3	
+(-327, 46)	2	
+(157, -150)	1	
+(-282, -149)	0	
+ at undiredgeset 
+		id	
+9	10	17	
+1	9	15	
+3	9	14	
+2	8	4	
+6	8	1	
+0	8	0	
+8	7	7	
+0	6	2	
+9	5	16	
+4	5	13	
+1	5	12	
+10	4	18	
+3	4	11	
+10	3	19	
+7	3	10	
+1	3	6	
+2	3	3	
+0	2	5	
+7	1	9	
+6	1	8	
+ at end



More information about the Lemon-commits mailing list