Input file for coloring.
authordeba
Tue, 13 Sep 2005 12:41:02 +0000
changeset 168313648409b596
parent 1682 e99072f86ab8
child 1684 df3820d7989d
Input file for coloring.
demo/coloring.cc
demo/coloring.lgf
     1.1 --- a/demo/coloring.cc	Tue Sep 13 05:19:11 2005 +0000
     1.2 +++ b/demo/coloring.cc	Tue Sep 13 12:41:02 2005 +0000
     1.3 @@ -28,18 +28,7 @@
     1.4  using namespace std;
     1.5  using namespace lemon;
     1.6  
     1.7 -int main(int argc, char *argv[]) 
     1.8 -{
     1.9 -  if(argc<2)
    1.10 -  {
    1.11 -      std::cerr << "USAGE: coloring input_file.lgf" << std::endl;
    1.12 -      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;
    1.13 -      return 0;
    1.14 -  }
    1.15 -
    1.16 -
    1.17 -  //input stream to read the graph from
    1.18 -  std::ifstream is(argv[1]);
    1.19 +int main() {
    1.20  
    1.21    typedef UndirSmartGraph Graph;
    1.22    typedef Graph::Node Node;
    1.23 @@ -47,9 +36,13 @@
    1.24    typedef Graph::UndirEdge UndirEdge;
    1.25    typedef Graph::IncEdgeIt IncEdgeIt;
    1.26  
    1.27 +  std::cout << "Six coloring of a plan graph" << std::endl;
    1.28 +  std::cout << "Input file: coloring.lgf" << std::endl;
    1.29 +  std::cout << "Output file: coloring.eps" << std::endl;
    1.30 +
    1.31    Graph graph;
    1.32  
    1.33 -  UndirGraphReader<Graph> reader(is, graph);
    1.34 +  UndirGraphReader<Graph> reader("coloring.lgf", graph);
    1.35    Graph::NodeMap<xy<double> > coords(graph);
    1.36    reader.readNodeMap("coords", coords);
    1.37    
    1.38 @@ -94,10 +87,10 @@
    1.39  
    1.40    ColorSet colorSet;
    1.41  
    1.42 -  graphToEps(graph, "six_coloring.eps").
    1.43 -    title("Six Colored Graph").copyright("(C) 2005 LEMON Project").
    1.44 +  graphToEps(graph, "coloring.eps").
    1.45 +    title("Six Colored Plan Graph").copyright("(C) 2005 LEMON Project").
    1.46      coords(coords).nodeColors(composeMap(colorSet, color)).
    1.47 -    scaleToA4().run();
    1.48 +    nodeScale(5.0).scaleToA4().run();
    1.49  
    1.50    return 0;
    1.51  }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/demo/coloring.lgf	Tue Sep 13 12:41:02 2005 +0000
     2.3 @@ -0,0 +1,36 @@
     2.4 +@nodeset 
     2.5 +coords	id	
     2.6 +(162, 142)	10	
     2.7 +(169, -35)	9	
     2.8 +(-154, -37)	8	
     2.9 +(-1, 12)	7	
    2.10 +(-87, -197)	6	
    2.11 +(360, 54)	5	
    2.12 +(193, 257)	4	
    2.13 +(-89, 224)	3	
    2.14 +(-327, 46)	2	
    2.15 +(157, -150)	1	
    2.16 +(-282, -149)	0	
    2.17 +@undiredgeset 
    2.18 +		id	
    2.19 +9	10	17	
    2.20 +1	9	15	
    2.21 +3	9	14	
    2.22 +2	8	4	
    2.23 +6	8	1	
    2.24 +0	8	0	
    2.25 +8	7	7	
    2.26 +0	6	2	
    2.27 +9	5	16	
    2.28 +4	5	13	
    2.29 +1	5	12	
    2.30 +10	4	18	
    2.31 +3	4	11	
    2.32 +10	3	19	
    2.33 +7	3	10	
    2.34 +1	3	6	
    2.35 +2	3	3	
    2.36 +0	2	5	
    2.37 +7	1	9	
    2.38 +6	1	8	
    2.39 +@end