Demos' documentations include the source.
authoralpar
Wed, 17 Aug 2005 22:07:35 +0000
changeset 164177f6ab7ad66f
parent 1640 9c7834ac5e64
child 1642 a2dda876316f
Demos' documentations include the source.
demo/dijkstra_demo.cc
demo/dim_to_lgf.cc
demo/graph_to_eps_demo.cc
demo/hello_lemon.cc
demo/kruskal_demo.cc
demo/lp_demo.cc
demo/lp_maxflow_demo.cc
demo/reader_writer_demo.cc
demo/sub_graph_adaptor_demo.cc
lemon/smart_graph.h
     1.1 --- a/demo/dijkstra_demo.cc	Wed Aug 17 21:52:50 2005 +0000
     1.2 +++ b/demo/dijkstra_demo.cc	Wed Aug 17 22:07:35 2005 +0000
     1.3 @@ -22,12 +22,13 @@
     1.4  /// a graph with edge lengths. Here we only show some of the
     1.5  /// facilities supplied by our implementation: for the detailed
     1.6  /// documentation of the LEMON Dijkstra class read \ref lemon::Dijkstra "this".
     1.7 +///
     1.8 +/// \include dijkstra_demo.cc
     1.9  
    1.10  #include <iostream>
    1.11  
    1.12  #include <lemon/list_graph.h>
    1.13  #include <lemon/dijkstra.h>
    1.14 -//#include <lemon/graph_writer.h>
    1.15  
    1.16  using namespace lemon;
    1.17  
    1.18 @@ -69,39 +70,35 @@
    1.19      len.set(v4_t, 8);
    1.20      len.set(v5_t, 8);
    1.21  
    1.22 -    std::cout << "This program is a simple demo of the LEMON Dijkstra class."<<std::endl;
    1.23 -    std::cout << "We calculate the shortest path from node s to node t in a graph."<<std::endl;
    1.24 -    std::cout <<std::endl;
    1.25 +    std::cout << "This program is a simple demo of the LEMON Dijkstra class."
    1.26 +	      << std::endl;
    1.27 +    std::cout <<
    1.28 +      "We calculate the shortest path from node s to node t in a graph."
    1.29 +	      << std::endl;
    1.30 +    std::cout << std::endl;
    1.31  
    1.32  
    1.33 -    std::cout << "The id of s is " << g.id(s)<< ", the id of t is " << g.id(t)<<"."<<std::endl;
    1.34 +    std::cout << "The id of s is " << g.id(s)<< ", the id of t is "
    1.35 +	      << g.id(t) << "." << std::endl;
    1.36  
    1.37      std::cout << "Dijkstra algorithm demo..." << std::endl;
    1.38  
    1.39 -
    1.40      Dijkstra<Graph, LengthMap> dijkstra_test(g,len);
    1.41      
    1.42      dijkstra_test.run(s);
    1.43 +    
    1.44 +    std::cout << "The distance of node t from node s: "
    1.45 +	      << dijkstra_test.dist(t) << std::endl;
    1.46  
    1.47 +    std::cout << "The shortest path from s to t goes through the following "
    1.48 +	      << "nodes (the first one is t, the last one is s): "
    1.49 +	      << std::endl;
    1.50 +
    1.51 +    for (Node v=t;v != s; v=dijkstra_test.predNode(v)) {
    1.52 +      std::cout << g.id(v) << "<-";
    1.53 +    }
    1.54      
    1.55 -    std::cout << "The distance of node t from node s: " << dijkstra_test.dist(t)<<std::endl;
    1.56 -
    1.57 -    std::cout << "The shortest path from s to t goes through the following nodes (the first one is t, the last one is s): "<<std::endl;
    1.58 -
    1.59 -    for (Node v=t;v != s; v=dijkstra_test.predNode(v)){
    1.60 -	std::cout << g.id(v) << "<-";
    1.61 -    }
    1.62      std::cout << g.id(s) << std::endl;	
    1.63      
    1.64 -
    1.65      return 0;
    1.66  }
    1.67 -
    1.68 -
    1.69 -
    1.70 -
    1.71 -
    1.72 -
    1.73 -
    1.74 -
    1.75 -
     2.1 --- a/demo/dim_to_lgf.cc	Wed Aug 17 21:52:50 2005 +0000
     2.2 +++ b/demo/dim_to_lgf.cc	Wed Aug 17 22:07:35 2005 +0000
     2.3 @@ -20,6 +20,8 @@
     2.4  ///
     2.5  /// This program converts various DIMACS formats to the LEMON Graph Format
     2.6  /// (LGF).
     2.7 +///
     2.8 +/// \include dim_to_lgf.cc
     2.9  
    2.10  #include <iostream>
    2.11  #include <fstream>
     3.1 --- a/demo/graph_to_eps_demo.cc	Wed Aug 17 21:52:50 2005 +0000
     3.2 +++ b/demo/graph_to_eps_demo.cc	Wed Aug 17 22:07:35 2005 +0000
     3.3 @@ -25,6 +25,8 @@
     3.4  /// how to handle parallel egdes, how to change the properties (like
     3.5  /// color, shape, size, title etc.) of nodes and edges individually
     3.6  /// using appropriate \ref maps-page "graph maps".
     3.7 +///
     3.8 +/// \include graph_to_eps_demo.cc
     3.9  
    3.10  #include <cmath>
    3.11  
     4.1 --- a/demo/hello_lemon.cc	Wed Aug 17 21:52:50 2005 +0000
     4.2 +++ b/demo/hello_lemon.cc	Wed Aug 17 22:07:35 2005 +0000
     4.3 @@ -21,6 +21,8 @@
     4.4  /// This program is intended to be a "Hello World!" program that shows
     4.5  /// the very basic notions of the LEMON library: \ref graphs "graphs" and
     4.6  /// \ref maps-page "maps". Click on the links to read more about these.
     4.7 +///
     4.8 +/// \include hello_lemon.cc
     4.9  
    4.10  #include <iostream>
    4.11  #include <lemon/list_graph.h>
    4.12 @@ -81,7 +83,8 @@
    4.13    std::cout << "There is a map on the edges (length)!" << std::endl;
    4.14    std::cout <<  std::endl;
    4.15    for (EdgeIt i(g); i!=INVALID; ++i)
    4.16 -    std::cout << "length(" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")="<<length[i]<<std::endl;
    4.17 +    std::cout << "length(" << g.id(g.source(i)) << ","
    4.18 +	      << g.id(g.target(i)) << ")="<<length[i]<<std::endl;
    4.19  
    4.20    std::cout << std::endl;
    4.21  
     5.1 --- a/demo/kruskal_demo.cc	Wed Aug 17 21:52:50 2005 +0000
     5.2 +++ b/demo/kruskal_demo.cc	Wed Aug 17 22:07:35 2005 +0000
     5.3 @@ -20,6 +20,8 @@
     5.4  ///
     5.5  /// This demo program shows how to find a minimum weight spanning tree
     5.6  /// in a graph by using the Kruskal algorithm. 
     5.7 +///
     5.8 +/// \include kruskal_demo.cc
     5.9  
    5.10  #include <iostream>
    5.11  #include <vector>
    5.12 @@ -123,7 +125,8 @@
    5.13    for(int i=tree_edge_vec.size()-1; i>=0;  i--)
    5.14      std::cout << g.id(tree_edge_vec[i]) << ";" ;
    5.15    std::cout << std::endl;
    5.16 -  std::cout << "The size of the tree again is: "<< tree_edge_vec.size()<< std::endl; 
    5.17 +  std::cout << "The size of the tree again is: "<< tree_edge_vec.size()
    5.18 +	    << std::endl; 
    5.19  
    5.20    
    5.21    return 0;
     6.1 --- a/demo/lp_demo.cc	Wed Aug 17 21:52:50 2005 +0000
     6.2 +++ b/demo/lp_demo.cc	Wed Aug 17 22:07:35 2005 +0000
     6.3 @@ -23,6 +23,8 @@
     6.4  /// solve it using the underlying solver (GLPK or CPLEX for
     6.5  /// example). For the detailed documentation of the LEMON LP solver
     6.6  /// interface read \ref lemon::LpSolverBase "this".
     6.7 +///
     6.8 +/// \include lp_demo.cc
     6.9  
    6.10  #include <lemon/lp.h>
    6.11  
     7.1 --- a/demo/lp_maxflow_demo.cc	Wed Aug 17 21:52:50 2005 +0000
     7.2 +++ b/demo/lp_maxflow_demo.cc	Wed Aug 17 22:07:35 2005 +0000
     7.3 @@ -22,6 +22,8 @@
     7.4  /// problem using the LEMON LP solver interface. We would like to lay
     7.5  /// the emphasis on the simplicity of the way one can formulate LP
     7.6  /// constraints that arise in graph theory in our library LEMON .
     7.7 +///
     7.8 +/// \include lp_maxflow_demo.cc
     7.9  
    7.10  #include<lemon/graph_reader.h>
    7.11  #include<lemon/list_graph.h>
     8.1 --- a/demo/reader_writer_demo.cc	Wed Aug 17 21:52:50 2005 +0000
     8.2 +++ b/demo/reader_writer_demo.cc	Wed Aug 17 22:07:35 2005 +0000
     8.3 @@ -22,7 +22,8 @@
     8.4  /// This simple demo program gives an example of how to read and write
     8.5  /// a graph and additional maps (on the nodes or the edges) from/to a
     8.6  /// stream. 
     8.7 -
     8.8 +///
     8.9 +/// \include reader_writer_demo.cc
    8.10  
    8.11  #include <iostream>
    8.12  #include <lemon/smart_graph.h>
     9.1 --- a/demo/sub_graph_adaptor_demo.cc	Wed Aug 17 21:52:50 2005 +0000
     9.2 +++ b/demo/sub_graph_adaptor_demo.cc	Wed Aug 17 22:07:35 2005 +0000
     9.3 @@ -21,7 +21,8 @@
     9.4  ///
     9.5  /// This program computes a maximum number of edge-disjoint shortest paths
     9.6  /// between nodes \c s and \c t.
     9.7 -
     9.8 +///
     9.9 +/// \include sub_graph_adaptor_demo.cc
    9.10  
    9.11  // Use a DIMACS max flow file as input.
    9.12  // sub_graph_adaptor_demo < dimacs_max_flow_file
    10.1 --- a/lemon/smart_graph.h	Wed Aug 17 21:52:50 2005 +0000
    10.2 +++ b/lemon/smart_graph.h	Wed Aug 17 22:07:35 2005 +0000
    10.3 @@ -150,6 +150,8 @@
    10.4  
    10.5      protected:
    10.6        int n;
    10.7 +      ///\e
    10.8 +
    10.9        ///\todo It should be removed (or at least define a setToId() instead).
   10.10        ///
   10.11        Node(int nn) {n=nn;}