1.1 --- a/demo/sub_graph_adaptor_demo.cc Fri Jul 22 15:03:23 2005 +0000
1.2 +++ b/demo/sub_graph_adaptor_demo.cc Fri Jul 22 15:15:29 2005 +0000
1.3 @@ -1,9 +1,31 @@
1.4 -// -*- c++ -*-
1.5 +/* -*- C++ -*-
1.6 + * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
1.7 + *
1.8 + * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.9 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.10 + *
1.11 + * Permission to use, modify and distribute this software is granted
1.12 + * provided that this copyright notice appears in all copies. For
1.13 + * precise terms see the accompanying LICENSE file.
1.14 + *
1.15 + * This software is provided "AS IS" with no warranty of any kind,
1.16 + * express or implied, and with no claim as to its suitability for any
1.17 + * purpose.
1.18 + *
1.19 + */
1.20 +
1.21 +///\ingroup demos
1.22 +///\file
1.23 +///\brief Computing maximum number of edge-disjoint shortest paths
1.24 +///
1.25 +/// This program computes a maximum number of edge-disjoint shortest paths
1.26 +/// between nodes \c s and \c t.
1.27 +
1.28
1.29 // Use a DIMACS max flow file as input.
1.30 // sub_graph_adaptor_demo < dimacs_max_flow_file
1.31 -// This program computes a maximum number of edge-disjoint shortest paths
1.32 -// between s and t.
1.33 +// Modified to eat lemon graph format!
1.34 +
1.35
1.36 #include <iostream>
1.37 #include <fstream>
1.38 @@ -16,11 +38,9 @@
1.39 #include <lemon/preflow.h>
1.40 #include <tight_edge_filter_map.h>
1.41
1.42 +#include <lemon/graph_reader.h>
1.43
1.44
1.45 -//#include <lemon/graph_reader.h>
1.46 -//#include <lemon/graph_writer.h>
1.47 -
1.48 using namespace lemon;
1.49
1.50 using std::cout;
1.51 @@ -30,8 +50,11 @@
1.52 {
1.53 if(argc<2)
1.54 {
1.55 - std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl;
1.56 - 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.57 + std::cerr << "USAGE: sub_graph_adaptor_demo input_file.lgf" << std::endl;
1.58 + std::cerr << "The file 'input_file.lgf' has to contain a max flow "
1.59 + << "instance in \n LEMON format "
1.60 + << "(e.g. sub_gad_input.lgf is such a file)."
1.61 + << std::endl;
1.62 return 0;
1.63 }
1.64
1.65 @@ -51,17 +74,12 @@
1.66 Node s, t;
1.67 LengthMap length(g);
1.68
1.69 - readDimacs(is, g, length, s, t);
1.70 + //readDimacs(is, g, length, s, t);
1.71
1.72 -// GraphWriter<SmartGraph> writer(std::cout, g);
1.73 -// writer.writeEdgeMap("length", length);
1.74 -// writer.writeNode("source",s);
1.75 -// writer.writeNode("target",t);
1.76 -// writer.run();
1.77
1.78 -// GraphReader<ListGraph> reader(is,g);
1.79 -// reader.readNode("source",s).readNode("target",t)
1.80 -// .readEdgeMap("length",length).run();
1.81 + GraphReader<SmartGraph> reader(is,g);
1.82 + reader.readNode("source",s).readNode("target",t)
1.83 + .readEdgeMap("length",length).run();
1.84
1.85 cout << "edges with lengths (of form id, source--length->target): " << endl;
1.86 for(EdgeIt e(g); e!=INVALID; ++e)