demo/dim_to_dot.cc
changeset 1577 15098fb5275c
parent 1435 8e85e6bbefdf
child 1636 260ac104190f
     1.1 --- a/demo/dim_to_dot.cc	Wed Jul 20 16:03:41 2005 +0000
     1.2 +++ b/demo/dim_to_dot.cc	Wed Jul 20 16:05:04 2005 +0000
     1.3 @@ -6,6 +6,16 @@
     1.4  // This program can be an aid in making up to date visualized documantation 
     1.5  // of demo programs.
     1.6  
     1.7 +// For later documentation (if marci does not do it)
     1.8 +// Az a graphviz csomag egy egyszeru formatuma, ami egy graphrajzolo csomag.
     1.9 +// Az EdgeSubGraphAdaptor doksijaban szerepel egy kirajzolt graf. Azt nem
    1.10 +// kezzel csinaltam, hanem a megfelelo dim file-bol ezzel a progival. A
    1.11 +// doxygen ugyanis ilyet eszik, igy a juzer vizualisan is latja a grafot a
    1.12 +// doksiban, es sajat maga is le tudja futtatni az algoritmust, mert ott van
    1.13 +// a kezeben a dim file is. Es mivel ez egy generalt file, ezert ha vmit
    1.14 +// valtoztatunk a dim-en, ezt is konnyu bemasolni. Uff.
    1.15 +
    1.16 +
    1.17  #include <iostream>
    1.18  #include <fstream>
    1.19  
    1.20 @@ -17,8 +27,19 @@
    1.21  using std::cout;
    1.22  using std::endl;
    1.23  
    1.24 -int main()
    1.25 -{    
    1.26 +int main(int argc, char *argv[]) 
    1.27 +{
    1.28 +  if(argc<2)
    1.29 +  {
    1.30 +      std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl;
    1.31 +      std::cerr << "The file 'input_file.dim' has to contain a max flow instance in DIMACS format (e.g. sub_graph_adaptor_demo.dim is such a file)." << std::endl;
    1.32 +      return 0;
    1.33 +  }
    1.34 +
    1.35 +
    1.36 +  //input stream to read the graph from
    1.37 +  std::ifstream is(argv[1]);
    1.38 +
    1.39    typedef SmartGraph Graph;
    1.40  
    1.41    typedef Graph::Edge Edge;
    1.42 @@ -31,7 +52,7 @@
    1.43    Node s, t;
    1.44    LengthMap length(g);
    1.45  
    1.46 -  readDimacs(std::cin, g, length, s, t);
    1.47 +  readDimacs(is, g, length, s, t);
    1.48  
    1.49    cout << "digraph lemon_dot_example {" << endl;
    1.50    cout << "  node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;