doc/getstart.dox
changeset 1519 17e367a93cbb
parent 1517 b303c1741c9a
child 1520 c2c76e4598f6
equal deleted inserted replaced
4:f7d3a9ce86a2 5:9fe7a9218ec0
     1 /**
     1 /**
     2 \page getstart How to start using LEMON
     2 \page getstart How to start using LEMON
     3 
     3 
     4 In this page we detail how to start using LEMON, from downloading it to 
     4 In this page we detail how to start using LEMON, from downloading it to
     5 your computer, through the steps of installation to showing a simple
     5 your computer, through the steps of installation, to showing a simple
     6 "Hello World" type program that already uses LEMON. We assume that you have a
     6 "Hello World" type program that already uses LEMON. We assume that you
     7 basic knowledge of your operating system and \c C++ or \c C 
     7 have a basic knowledge of your operating system and \c C++ programming
     8 programming language. 
     8 language. The procedure is pretty straightforward, but if you have any
       
     9 difficulties don't hesitate to
       
    10 <a href="http://lemon.cs.elte.hu/mailinglists.html">ask</a>.
     9 
    11 
    10 \section requirementsLEMON Hardware and software requirements
    12 \section requirementsLEMON Hardware and software requirements
    11 
    13 
    12 Hardware requirements ...
    14 In LEMON we use C++ templates heavily, thus compilation takes a
       
    15 considerable amount of time and memory. So some decent box would be
       
    16 advantageous. But otherwise there are no special hardware requirements.
    13 
    17 
    14 You will also need a C++ compiler. We mostly used the Gnu C++ Compiler (g++),
    18 You will need a recent C++ compiler. Our primary target is the GNU C++
    15 from version 3.0 upwards. We also checked the Intel C compiler
    19 Compiler (g++), from version 3.3 upwards. We also checked the Intel C
    16 (icc). Unfortunately, Visual C++ compiler knows not enough to compile the
    20 compiler (icc). Microsoft Visual C++ .NET version was also reported to
    17 library, so if you are using Microsoft Windows, then try to compile under
    21 work (but not the earlier versions). If you want to develop with LEMON
    18 Cygwin. 
    22 under Windows you could consider using Cygwin.
    19 
    23 
    20 Ide kell írni:
       
    21  
       
    22 -Hol fordul (Windows-os fordító nem fordítja, unix/linux alatt gcc hanyas verziója kell)
       
    23 -
       
    24 
    24 
    25 In this description we will suppose a linux environment and Gnu C Compiler.
    25 In this description we will suppose a linux environment and GNU C Compiler.
    26 
    26 
    27 \section downloadLEMON How to download LEMON
    27 \section downloadLEMON How to download LEMON
    28 
    28 
    29 You can download LEMON from the LEMON web site:
    29 You can download LEMON from the LEMON web site:
    30 http://lemon.cs.elte.hu/dowload.html
    30 http://lemon.cs.elte.hu/dowload.html.
    31 . There you will find the issued distributions
    31 There you will find released versions in form of <tt>.tar.gz</tt> files.
    32 in form of <tt> .tar.gz </tt> files. If you want a developer version  (for example you want to contribute in developing the library LEMON) then you might want to use our Subversion repository. This case is not detailed here, so from now on we suppose that you downloaded a tar.gz file.
    32 If you want a developer version (for example you want to contribute in
       
    33 developing the library LEMON) then you might want to use our Subversion
       
    34 repository. This case is not detailed here, so from now on we suppose that
       
    35 you downloaded a tar.gz file.
    33 
    36 
    34 
    37 
    35 
    38 
    36 \section installLEMON How to install LEMON
    39 \section installLEMON How to install LEMON
    37 
    40 
    38 In order to install LEMON you have to do the following
    41 In order to install LEMON you have to do the following
    39 
    42 
    40 Download the tarball (named <tt>lemon-x.y.z.tar.gz</tt> where \c x,\c y and \c z are
    43 Download the tarball (named <tt>lemon-x.y.z.tar.gz</tt> where \c x,\c y
    41 numbers indicating the version of the library: in our example we will have lemon-0.3.1) and issue the following commands:
    44 and \c z are numbers indicating the version of the library: in our example
       
    45 we will have <tt>lemon-0.3.1.tar.gz</tt>) and issue the following
       
    46 commands:
    42 
    47 
    43 \code
    48 \verbatim
    44 tar xvzf lemon-0.3.1.tar.gz
    49 tar xvzf lemon-0.3.1.tar.gz
    45 cd lemon-0.3.1
    50 cd lemon-0.3.1
    46 ./configure
    51 ./configure
    47 make
    52 make
    48 make check (This is optional, but recomended. It runs a bunch of tests.)
    53 make check   #(This is optional, but recomended. It runs a bunch of tests.)
    49 make install
    54 make install
    50 \endcode
    55 \endverbatim
    51 
    56 
    52 These commands install LEMON under \c /usr/local (you will probably need \c root
    57 These commands install LEMON under \c /usr/local (you will
    53 privileges to be able to install to that directory). If you want to install it
    58 need root privileges to be able to install to that
    54 to some other place, then pass the \c --prefix=DIR flag to \c ./configure. In
    59 directory). If you want to install it to some other place, then
    55 what follows we will assume that you were able to install to directory \c
    60 pass the \c --prefix=DIR flag to \c ./configure. In what follows
    56 /usr/local, otherwise some extra care is to be taken to use the library.
    61 we will assume that you were able to install to directory
       
    62 \c /usr/local, otherwise some extra care is to be taken to use the
       
    63 library.
    57 
    64 
    58 We briefly explain these commands below.
    65 We briefly explain these commands below.
    59 
    66 
    60 \code
    67 \verbatim
    61 tar xvzf lemon-0.3.1.tar.gz
    68 tar xvzf lemon-0.3.1.tar.gz
    62 \endcode
    69 \endverbatim
    63 This command untars the <tt>tar.gz</tt> file into a directory named <tt> lemon-0.3.1</tt>.
    70 This command untars the <tt>tar.gz</tt> file into a directory named <tt>
       
    71 lemon-0.3.1</tt>.
    64 
    72 
    65 \code
    73 \verbatim
    66 cd lemon-0.3.1
    74 cd lemon-0.3.1
    67 \endcode
    75 \endverbatim
    68 Enters the directory.
    76 Enters the directory.
    69 
    77 
    70 \code
    78 \verbatim
    71 ./configure
    79 ./configure
    72 \endcode
    80 \endverbatim
    73 Does some configuration (creates makefiles etc).
    81 Does some configuration (creates makefiles etc).
       
    82 \todo Explain the most important switches here (gui, doc, glpk, cplex).
    74 
    83 
    75 \code
    84 \verbatim
    76 make
    85 make
    77 \endcode
    86 \endverbatim
    78 This command compiles the <tt> .cc</tt> files of the library package (the
    87 This command compiles the non-template part of LEMON into
    79 implementation of non-template functions and classes and some test and demo
    88 <b>libemon.a</b> file. It also compiles some benchmark and demo
    80 programs) and creates the very important <b> libemon.la </b> file. When
    89 programs.
    81 linking your program that uses LEMON it needs to access this file.
       
    82 
    90 
    83 \code
    91 \verbatim
    84 make check (This is optional, but recomended. It runs a bunch of tests.)
    92 make check
    85 \endcode
    93 \endverbatim
    86 This is an optional step: it runs the test programs that we developed for
    94 This is an optional step: it runs the test programs that we
    87 LEMON to check
    95 developed for LEMON to check whether the library works properly on
    88 whether the library works properly on your platform.
    96 your platform.
    89 
    97 
    90 \code
    98 \verbatim
    91 make install
    99 make install
    92 \endcode
   100 \endverbatim
    93 This will copy the directory structure to its final destination (e.g. to \c
   101 This will copy the directory structure to its final destination (e.g. to \c
    94 /usr/local) so that your system can access it.
   102 /usr/local) so that your system can access it. This command should
       
   103 be issued as "root", unless you provided a \c --prefix switch to
       
   104 the \c cofugure to install the library in non-default location.
    95 
   105 
    96 \section helloworld My first program using LEMON
   106 \section helloworld My first program using LEMON
    97 
   107 
    98 If you have installed LEMON on your system you 
   108 If you have installed LEMON on your system you can paste the
    99 can paste the following code
   109 following code segment into a file (named e.g. \c hello_lemon.cc)
   100 segment into a file to have a first working program that uses library LEMON.
   110 to have a first working program that uses library LEMON.
   101 
   111 
   102 \code
   112 \code
   103 #include <iostream>
   113 #include <iostream>
   104 #include <lemon/list_graph.h>
   114 #include <lemon/list_graph.h>
   105 
   115 
   106 using namespace lemon;
       
   107 
       
   108 int main()
   116 int main()
   109 {
   117 {
   110   typedef ListGraph Graph;
   118   typedef lemon::ListGraph Graph;
   111   typedef Graph::EdgeIt EdgeIt;
   119   typedef Graph::EdgeIt EdgeIt;
   112   typedef Graph::NodeIt NodeIt;
   120   typedef Graph::NodeIt NodeIt;
       
   121   using lemon::INVALID;
   113 
   122 
   114   Graph g;
   123   Graph g;
   115   
   124   
   116   for (int i = 0; i < 3; i++)
   125   for (int i = 0; i < 3; i++)
   117     g.addNode();
   126     g.addNode();
   127 
   136 
   128   std::cout << "Edges:";
   137   std::cout << "Edges:";
   129   for (EdgeIt i(g); i!=INVALID; ++i)
   138   for (EdgeIt i(g); i!=INVALID; ++i)
   130     std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
   139     std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
   131   std::cout << std::endl;
   140   std::cout << std::endl;
   132 
   141 }
   133 \endcode
   142 \endcode
   134 
   143 
   135 First let us briefly explain how this program works.
   144 First let us briefly explain how this program works.
   136 
   145 
   137 ListGraph is one of LEMON's graph classes. It is based on linked lists,
   146 ListGraph is one of LEMON's graph classes. It is based on linked lists,
   148 
   157 
   149 We can also iterate through all edges of the graph very similarly. The 
   158 We can also iterate through all edges of the graph very similarly. The 
   150 \c target and
   159 \c target and
   151 \c source member functions can be used to access the endpoints of an edge.
   160 \c source member functions can be used to access the endpoints of an edge.
   152 
   161 
   153 If you have saved the preceding code into a file named, say,  \c hemon.cc and your installation of LEMON into directory \c /usr/local was
   162 If you have saved the preceding code into a file named, say, \c
   154 successful then it is very easy to compile this program with the following
   163 hello_lemon.cc and your installation of LEMON into directory \c
   155 command (the argument <tt>-lemon</tt> tells the compiler that we are using the
   164 /usr/local was successful then it is very easy to compile this
   156 installed library LEMON):
   165 program with the following command (the argument <tt>-lemon</tt>
   157 \code
   166 tells the compiler that we are using the installed library LEMON):
   158 g++ hemon.cc -o hemon -lemon
       
   159 \endcode
       
   160 
   167 
   161 As a result you will get the exacutable \c hemon in
   168 \verbatim
       
   169 g++ hello_lemon.cc -o hello_lemon -lemon
       
   170 \endverbatim
       
   171 
       
   172 As a result you will get the exacutable \c hello_lemon in
   162 this directory that you can run by the command 
   173 this directory that you can run by the command 
   163 \code
   174 \verbatim
   164 ./hemon
   175 ./hello_lemon
   165 \endcode
   176 \endverbatim
   166 
   177 
   167 
   178 
   168 If everything has gone well then the previous code fragment prints out the following:
   179 If everything has gone well then the previous code fragment prints
       
   180 out the following:
   169 
   181 
   170 \code
   182 \verbatim
   171 Nodes: 2 1 0
   183 Nodes: 2 1 0
   172 
   184 
   173 Edges: (0,2) (1,2) (0,1) (2,1) (1,0) (2,0)
   185 Edges: (0,2) (1,2) (0,1) (2,1) (1,0) (2,0)
   174 \endcode
   186 \endverbatim
   175 
   187 
   176 Congratulations!
   188 Congratulations!
   177 
   189 
   178 If you want to see more features, go to the \ref quicktour "Quick Tour to
   190 If you want to see more features, go to the
   179 LEMON", if you want to see see some demo programs then go to our 
   191 \ref quicktour "Quick Tour to LEMON",
       
   192 if you want to see see some demo programs then go to our 
   180 \ref demoprograms "Demo Programs" page! 
   193 \ref demoprograms "Demo Programs" page! 
   181 
   194 
   182 
   195 
   183 */
   196 */