getstart: hello_lemon.cc moved to a separate file in demo/
authorklao
Mon, 27 Jun 2005 20:44:29 +0000
changeset 1520c2c76e4598f6
parent 1519 17e367a93cbb
child 1521 5815b382421b
getstart: hello_lemon.cc moved to a separate file in demo/
demo/Makefile.am
demo/hello_lemon.cc
doc/getstart.dox
     1.1 --- a/demo/Makefile.am	Mon Jun 27 19:47:09 2005 +0000
     1.2 +++ b/demo/Makefile.am	Mon Jun 27 20:44:29 2005 +0000
     1.3 @@ -8,6 +8,7 @@
     1.4  	dim_to_lgf \
     1.5  	graph_to_eps_demo \
     1.6  	min_route \
     1.7 +	hello_lemon \
     1.8  	sub_graph_adaptor_demo \
     1.9  	coloring
    1.10  
    1.11 @@ -30,6 +31,8 @@
    1.12  
    1.13  min_route_SOURCES = min_route.cc
    1.14  
    1.15 +hello_lemon_SOURCES = hello_lemon.cc
    1.16 +
    1.17  sub_graph_adaptor_demo_SOURCES = \
    1.18  	sub_graph_adaptor_demo.cc \
    1.19  	tight_edge_filter_map.h
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/demo/hello_lemon.cc	Mon Jun 27 20:44:29 2005 +0000
     2.3 @@ -0,0 +1,29 @@
     2.4 +#include <iostream>
     2.5 +#include <lemon/list_graph.h>
     2.6 +
     2.7 +int main()
     2.8 +{
     2.9 +  typedef lemon::ListGraph Graph;
    2.10 +  typedef Graph::EdgeIt EdgeIt;
    2.11 +  typedef Graph::NodeIt NodeIt;
    2.12 +  using lemon::INVALID;
    2.13 +
    2.14 +  Graph g;
    2.15 +  
    2.16 +  for (int i = 0; i < 3; i++)
    2.17 +    g.addNode();
    2.18 +  
    2.19 +  for (NodeIt i(g); i!=INVALID; ++i)
    2.20 +    for (NodeIt j(g); j!=INVALID; ++j)
    2.21 +      if (i != j) g.addEdge(i, j);
    2.22 +
    2.23 +  std::cout << "Nodes:";
    2.24 +  for (NodeIt i(g); i!=INVALID; ++i)
    2.25 +    std::cout << " " << g.id(i);
    2.26 +  std::cout << std::endl;
    2.27 +
    2.28 +  std::cout << "Edges:";
    2.29 +  for (EdgeIt i(g); i!=INVALID; ++i)
    2.30 +    std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
    2.31 +  std::cout << std::endl;
    2.32 +}
     3.1 --- a/doc/getstart.dox	Mon Jun 27 19:47:09 2005 +0000
     3.2 +++ b/doc/getstart.dox	Mon Jun 27 20:44:29 2005 +0000
     3.3 @@ -106,40 +106,11 @@
     3.4  \section helloworld My first program using LEMON
     3.5  
     3.6  If you have installed LEMON on your system you can paste the
     3.7 -following code segment into a file (named e.g. \c hello_lemon.cc)
     3.8 -to have a first working program that uses library LEMON.
     3.9 +following code segment into a file (you can find it as \c
    3.10 +demo/hello_lemon.cc in the LEMON package) to have a first working
    3.11 +program that uses library LEMON.
    3.12  
    3.13 -\code
    3.14 -#include <iostream>
    3.15 -#include <lemon/list_graph.h>
    3.16 -
    3.17 -int main()
    3.18 -{
    3.19 -  typedef lemon::ListGraph Graph;
    3.20 -  typedef Graph::EdgeIt EdgeIt;
    3.21 -  typedef Graph::NodeIt NodeIt;
    3.22 -  using lemon::INVALID;
    3.23 -
    3.24 -  Graph g;
    3.25 -  
    3.26 -  for (int i = 0; i < 3; i++)
    3.27 -    g.addNode();
    3.28 -  
    3.29 -  for (NodeIt i(g); i!=INVALID; ++i)
    3.30 -    for (NodeIt j(g); j!=INVALID; ++j)
    3.31 -      if (i != j) g.addEdge(i, j);
    3.32 -
    3.33 -  std::cout << "Nodes:";
    3.34 -  for (NodeIt i(g); i!=INVALID; ++i)
    3.35 -    std::cout << " " << g.id(i);
    3.36 -  std::cout << std::endl;
    3.37 -
    3.38 -  std::cout << "Edges:";
    3.39 -  for (EdgeIt i(g); i!=INVALID; ++i)
    3.40 -    std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
    3.41 -  std::cout << std::endl;
    3.42 -}
    3.43 -\endcode
    3.44 +\include hello_lemon.cc
    3.45  
    3.46  First let us briefly explain how this program works.
    3.47  
    3.48 @@ -159,11 +130,10 @@
    3.49  \c target and
    3.50  \c source member functions can be used to access the endpoints of an edge.
    3.51  
    3.52 -If you have saved the preceding code into a file named, say, \c
    3.53 -hello_lemon.cc and your installation of LEMON into directory \c
    3.54 -/usr/local was successful then it is very easy to compile this
    3.55 -program with the following command (the argument <tt>-lemon</tt>
    3.56 -tells the compiler that we are using the installed library LEMON):
    3.57 +If your installation of LEMON into directory \c /usr/local was
    3.58 +successful then it is very easy to compile this program with the
    3.59 +following command (the argument <tt>-lemon</tt> tells the compiler
    3.60 +that we are using the installed library LEMON):
    3.61  
    3.62  \verbatim
    3.63  g++ hello_lemon.cc -o hello_lemon -lemon