demo/sub_graph_adaptor_demo.cc
changeset 1577 15098fb5275c
parent 1560 01707a8a4ca6
child 1583 2b329fd595ef
equal deleted inserted replaced
2:d2ff192c9318 3:41e3b49536ba
    14 #include <lemon/graph_adaptor.h>
    14 #include <lemon/graph_adaptor.h>
    15 #include <lemon/dimacs.h>
    15 #include <lemon/dimacs.h>
    16 #include <lemon/preflow.h>
    16 #include <lemon/preflow.h>
    17 #include <tight_edge_filter_map.h>
    17 #include <tight_edge_filter_map.h>
    18 
    18 
       
    19 
       
    20 
       
    21 //#include <lemon/graph_reader.h>
       
    22 //#include <lemon/graph_writer.h>
       
    23 
    19 using namespace lemon;
    24 using namespace lemon;
    20 
    25 
    21 using std::cout;
    26 using std::cout;
    22 using std::endl;
    27 using std::endl;
    23 
    28 
    24 int main(int argc, char *argv[]) 
    29 int main(int argc, char *argv[]) 
    25 {
    30 {
    26   if(argc<2)
    31   if(argc<2)
    27   {
    32   {
    28       std::cerr << "USAGE: sub_graph_adaptor_demo <input_file.dim>" << std::endl;
    33       std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl;
    29       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;
    34       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;
    30       return 0;
    35       return 0;
    31   }
    36   }
    32 
    37 
    33 
    38 
    45   Graph g;
    50   Graph g;
    46   Node s, t;
    51   Node s, t;
    47   LengthMap length(g);
    52   LengthMap length(g);
    48 
    53 
    49   readDimacs(is, g, length, s, t);
    54   readDimacs(is, g, length, s, t);
       
    55 
       
    56 //     GraphWriter<SmartGraph> writer(std::cout, g);
       
    57 //     writer.writeEdgeMap("length", length);
       
    58 //     writer.writeNode("source",s);
       
    59 //     writer.writeNode("target",t);
       
    60 //     writer.run();
       
    61 
       
    62 //   GraphReader<ListGraph> reader(is,g);
       
    63 //   reader.readNode("source",s).readNode("target",t)
       
    64 //     .readEdgeMap("length",length).run();
    50 
    65 
    51   cout << "edges with lengths (of form id, source--length->target): " << endl;
    66   cout << "edges with lengths (of form id, source--length->target): " << endl;
    52   for(EdgeIt e(g); e!=INVALID; ++e) 
    67   for(EdgeIt e(g); e!=INVALID; ++e) 
    53     cout << " " << g.id(e) << ", " << g.id(g.source(e)) << "--" 
    68     cout << " " << g.id(e) << ", " << g.id(g.source(e)) << "--" 
    54 	 << length[e] << "->" << g.id(g.target(e)) << endl;
    69 	 << length[e] << "->" << g.id(g.target(e)) << endl;