demo/coloring.cc
changeset 1560 01707a8a4ca6
parent 1435 8e85e6bbefdf
child 1577 15098fb5275c
     1.1 --- a/demo/coloring.cc	Fri Jul 15 14:35:07 2005 +0000
     1.2 +++ b/demo/coloring.cc	Fri Jul 15 16:01:55 2005 +0000
     1.3 @@ -5,10 +5,26 @@
     1.4  #include <lemon/graph_reader.h>
     1.5  #include <lemon/graph_to_eps.h>
     1.6  
     1.7 +#include <fstream>
     1.8 +#include <iostream>
     1.9 +
    1.10 +
    1.11  using namespace std;
    1.12  using namespace lemon;
    1.13  
    1.14 -int main() {
    1.15 +int main(int argc, char *argv[]) 
    1.16 +{
    1.17 +  if(argc<2)
    1.18 +  {
    1.19 +      std::cerr << "USAGE: coloring <input_file.lgf>" << std::endl;
    1.20 +      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.21 +      return 0;
    1.22 +  }
    1.23 +
    1.24 +
    1.25 +  //input stream to read the graph from
    1.26 +  std::ifstream is(argv[1]);
    1.27 +
    1.28    typedef UndirSmartGraph Graph;
    1.29    typedef Graph::Node Node;
    1.30    typedef Graph::NodeIt NodeIt;
    1.31 @@ -17,7 +33,7 @@
    1.32  
    1.33    Graph graph;
    1.34  
    1.35 -  UndirGraphReader<Graph> reader(std::cin, graph);
    1.36 +  UndirGraphReader<Graph> reader(is, graph);
    1.37    Graph::NodeMap<xy<double> > coords(graph);
    1.38    reader.readNodeMap("coords", coords);
    1.39