Documented some more demo programs.
authorathos
Fri, 22 Jul 2005 15:15:29 +0000
changeset 15832b329fd595ef
parent 1582 5fd89def7cbc
child 1584 cf4bc8d477f4
Documented some more demo programs.
demo/dijkstra_demo.cc
demo/hello_lemon.cc
demo/kruskal_demo.cc
demo/lp_maxflow_demo.cc
demo/reader_writer_demo.cc
demo/sub_graph_adaptor_demo.cc
     1.1 --- a/demo/dijkstra_demo.cc	Fri Jul 22 15:03:23 2005 +0000
     1.2 +++ b/demo/dijkstra_demo.cc	Fri Jul 22 15:15:29 2005 +0000
     1.3 @@ -1,3 +1,28 @@
     1.4 +/* -*- C++ -*-
     1.5 + * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
     1.6 + *
     1.7 + * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     1.8 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
     1.9 + *
    1.10 + * Permission to use, modify and distribute this software is granted
    1.11 + * provided that this copyright notice appears in all copies. For
    1.12 + * precise terms see the accompanying LICENSE file.
    1.13 + *
    1.14 + * This software is provided "AS IS" with no warranty of any kind,
    1.15 + * express or implied, and with no claim as to its suitability for any
    1.16 + * purpose.
    1.17 + *
    1.18 + */
    1.19 +
    1.20 +///\ingroup demos
    1.21 +///\file
    1.22 +///\brief Demonstrating LEMON implementation of the Dijkstra algorithm
    1.23 +///
    1.24 +/// Dijkstra's algorithm computes shortest paths between two nodes in
    1.25 +/// a graph with edge lengths. Here we only show some of the
    1.26 +/// facilities supplied by our implementation: for the detailed
    1.27 +/// documentation of the LEMON Dijkstra class read \ref lemon::Dijkstra "this".
    1.28 +
    1.29  #include <iostream>
    1.30  
    1.31  #include <lemon/list_graph.h>
    1.32 @@ -51,7 +76,7 @@
    1.33  
    1.34      std::cout << "The id of s is " << g.id(s)<< ", the id of t is " << g.id(t)<<"."<<std::endl;
    1.35  
    1.36 -    std::cout << "Dijkstra algorithm test..." << std::endl;
    1.37 +    std::cout << "Dijkstra algorithm demo..." << std::endl;
    1.38  
    1.39  
    1.40      Dijkstra<Graph, LengthMap> dijkstra_test(g,len);
     2.1 --- a/demo/hello_lemon.cc	Fri Jul 22 15:03:23 2005 +0000
     2.2 +++ b/demo/hello_lemon.cc	Fri Jul 22 15:15:29 2005 +0000
     2.3 @@ -1,3 +1,27 @@
     2.4 +/* -*- C++ -*-
     2.5 + * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
     2.6 + *
     2.7 + * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     2.8 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
     2.9 + *
    2.10 + * Permission to use, modify and distribute this software is granted
    2.11 + * provided that this copyright notice appears in all copies. For
    2.12 + * precise terms see the accompanying LICENSE file.
    2.13 + *
    2.14 + * This software is provided "AS IS" with no warranty of any kind,
    2.15 + * express or implied, and with no claim as to its suitability for any
    2.16 + * purpose.
    2.17 + *
    2.18 + */
    2.19 +
    2.20 +///\ingroup demos
    2.21 +///\file
    2.22 +///\brief LEMON style "Hello World!" program
    2.23 +///
    2.24 +/// This program is intended to be a "Hello World!" program that shows
    2.25 +/// the very basic notions of the LEMON library: \ref graphs "graphs" and
    2.26 +/// \ref maps-page "maps". Click on the links to read more about these.
    2.27 +
    2.28  #include <iostream>
    2.29  #include <lemon/list_graph.h>
    2.30  
     3.1 --- a/demo/kruskal_demo.cc	Fri Jul 22 15:03:23 2005 +0000
     3.2 +++ b/demo/kruskal_demo.cc	Fri Jul 22 15:15:29 2005 +0000
     3.3 @@ -18,8 +18,8 @@
     3.4  ///\file
     3.5  ///\brief Minimum weight spanning tree by Kruskal algorithm (demo).
     3.6  ///
     3.7 -///This demo program shows how to find a minimum weight spannin tree
     3.8 -///of a graph by using the Kruskal algorithm. 
     3.9 +/// This demo program shows how to find a minimum weight spanning tree
    3.10 +/// in a graph by using the Kruskal algorithm. 
    3.11  
    3.12  #include <iostream>
    3.13  #include <vector>
     4.1 --- a/demo/lp_maxflow_demo.cc	Fri Jul 22 15:03:23 2005 +0000
     4.2 +++ b/demo/lp_maxflow_demo.cc	Fri Jul 22 15:15:29 2005 +0000
     4.3 @@ -18,10 +18,10 @@
     4.4  ///\file
     4.5  ///\brief Max flow problem solved with an LP solver (demo).
     4.6  ///
     4.7 -///This demo program shows how to solve a maximum (or maximal) flow
     4.8 -///problem using the LEMON LP solver interface. We would like to lay
     4.9 -///the emphasis on the simplicity of the way one can formulate the LP
    4.10 -///constraints with LEMON that arise in graph theory.
    4.11 +/// This demo program shows how to solve a maximum (or maximal) flow
    4.12 +/// problem using the LEMON LP solver interface. We would like to lay
    4.13 +/// the emphasis on the simplicity of the way one can formulate LP
    4.14 +/// constraints that arise in graph theory in our library LEMON .
    4.15  
    4.16  #ifdef HAVE_CONFIG_H
    4.17  #include <config.h>
     5.1 --- a/demo/reader_writer_demo.cc	Fri Jul 22 15:03:23 2005 +0000
     5.2 +++ b/demo/reader_writer_demo.cc	Fri Jul 22 15:15:29 2005 +0000
     5.3 @@ -1,3 +1,28 @@
     5.4 +/* -*- C++ -*-
     5.5 + * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
     5.6 + *
     5.7 + * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     5.8 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
     5.9 + *
    5.10 + * Permission to use, modify and distribute this software is granted
    5.11 + * provided that this copyright notice appears in all copies. For
    5.12 + * precise terms see the accompanying LICENSE file.
    5.13 + *
    5.14 + * This software is provided "AS IS" with no warranty of any kind,
    5.15 + * express or implied, and with no claim as to its suitability for any
    5.16 + * purpose.
    5.17 + *
    5.18 + */
    5.19 +
    5.20 +///\ingroup demos
    5.21 +///\file
    5.22 +///\brief Demonstrating graph input and output
    5.23 +///
    5.24 +/// This simple demo program gives an example of how to read and write
    5.25 +/// a graph and additional maps (on the nodes or the edges) from/to a
    5.26 +/// stream. 
    5.27 +
    5.28 +
    5.29  #include <iostream>
    5.30  #include <lemon/smart_graph.h>
    5.31  #include <lemon/invalid.h>
    5.32 @@ -18,7 +43,7 @@
    5.33      reader.run();
    5.34  
    5.35      std::cout << "Hello! We have read a graph from file " << filename<< 
    5.36 -      " and some maps on it: now we write this to the standard output!" << 
    5.37 +      " and some maps on it:\n now we write it to the standard output!" << 
    5.38        std::endl;
    5.39  
    5.40  
     6.1 --- a/demo/sub_graph_adaptor_demo.cc	Fri Jul 22 15:03:23 2005 +0000
     6.2 +++ b/demo/sub_graph_adaptor_demo.cc	Fri Jul 22 15:15:29 2005 +0000
     6.3 @@ -1,9 +1,31 @@
     6.4 -// -*- c++ -*-
     6.5 +/* -*- C++ -*-
     6.6 + * demo/lp_maxflow_demo.cc - Part of LEMON, a generic C++ optimization library
     6.7 + *
     6.8 + * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6.9 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
    6.10 + *
    6.11 + * Permission to use, modify and distribute this software is granted
    6.12 + * provided that this copyright notice appears in all copies. For
    6.13 + * precise terms see the accompanying LICENSE file.
    6.14 + *
    6.15 + * This software is provided "AS IS" with no warranty of any kind,
    6.16 + * express or implied, and with no claim as to its suitability for any
    6.17 + * purpose.
    6.18 + *
    6.19 + */
    6.20 +
    6.21 +///\ingroup demos
    6.22 +///\file
    6.23 +///\brief Computing maximum number of edge-disjoint shortest paths
    6.24 +///
    6.25 +/// This program computes a maximum number of edge-disjoint shortest paths
    6.26 +/// between nodes \c s and \c t.
    6.27 +
    6.28  
    6.29  // Use a DIMACS max flow file as input.
    6.30  // sub_graph_adaptor_demo < dimacs_max_flow_file
    6.31 -// This program computes a maximum number of edge-disjoint shortest paths
    6.32 -// between s and t.
    6.33 +// Modified to eat lemon graph format! 
    6.34 +
    6.35  
    6.36  #include <iostream>
    6.37  #include <fstream>
    6.38 @@ -16,11 +38,9 @@
    6.39  #include <lemon/preflow.h>
    6.40  #include <tight_edge_filter_map.h>
    6.41  
    6.42 +#include <lemon/graph_reader.h>
    6.43  
    6.44  
    6.45 -//#include <lemon/graph_reader.h>
    6.46 -//#include <lemon/graph_writer.h>
    6.47 -
    6.48  using namespace lemon;
    6.49  
    6.50  using std::cout;
    6.51 @@ -30,8 +50,11 @@
    6.52  {
    6.53    if(argc<2)
    6.54    {
    6.55 -      std::cerr << "USAGE: sub_graph_adaptor_demo input_file.dim" << std::endl;
    6.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;
    6.57 +      std::cerr << "USAGE: sub_graph_adaptor_demo input_file.lgf" << std::endl;
    6.58 +      std::cerr << "The file 'input_file.lgf' has to contain a max flow "
    6.59 +		<< "instance in \n LEMON format "
    6.60 +		<< "(e.g. sub_gad_input.lgf is such a file)." 
    6.61 +		<< std::endl;
    6.62        return 0;
    6.63    }
    6.64  
    6.65 @@ -51,17 +74,12 @@
    6.66    Node s, t;
    6.67    LengthMap length(g);
    6.68  
    6.69 -  readDimacs(is, g, length, s, t);
    6.70 +  //readDimacs(is, g, length, s, t);
    6.71  
    6.72 -//     GraphWriter<SmartGraph> writer(std::cout, g);
    6.73 -//     writer.writeEdgeMap("length", length);
    6.74 -//     writer.writeNode("source",s);
    6.75 -//     writer.writeNode("target",t);
    6.76 -//     writer.run();
    6.77  
    6.78 -//   GraphReader<ListGraph> reader(is,g);
    6.79 -//   reader.readNode("source",s).readNode("target",t)
    6.80 -//     .readEdgeMap("length",length).run();
    6.81 +  GraphReader<SmartGraph> reader(is,g);
    6.82 +  reader.readNode("source",s).readNode("target",t)
    6.83 +    .readEdgeMap("length",length).run();
    6.84  
    6.85    cout << "edges with lengths (of form id, source--length->target): " << endl;
    6.86    for(EdgeIt e(g); e!=INVALID; ++e)