COIN-OR::LEMON - Graph Library

Changeset 1520:c2c76e4598f6 in lemon-0.x for doc


Ignore:
Timestamp:
06/27/05 22:44:29 (14 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2005
Message:

getstart: hello_lemon.cc moved to a separate file in demo/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/getstart.dox

    r1519 r1520  
    107107
    108108If you have installed LEMON on your system you can paste the
    109 following code segment into a file (named e.g. \c hello_lemon.cc)
    110 to have a first working program that uses library LEMON.
     109following code segment into a file (you can find it as \c
     110demo/hello_lemon.cc in the LEMON package) to have a first working
     111program that uses library LEMON.
    111112
    112 \code
    113 #include <iostream>
    114 #include <lemon/list_graph.h>
    115 
    116 int main()
    117 {
    118   typedef lemon::ListGraph Graph;
    119   typedef Graph::EdgeIt EdgeIt;
    120   typedef Graph::NodeIt NodeIt;
    121   using lemon::INVALID;
    122 
    123   Graph g;
    124  
    125   for (int i = 0; i < 3; i++)
    126     g.addNode();
    127  
    128   for (NodeIt i(g); i!=INVALID; ++i)
    129     for (NodeIt j(g); j!=INVALID; ++j)
    130       if (i != j) g.addEdge(i, j);
    131 
    132   std::cout << "Nodes:";
    133   for (NodeIt i(g); i!=INVALID; ++i)
    134     std::cout << " " << g.id(i);
    135   std::cout << std::endl;
    136 
    137   std::cout << "Edges:";
    138   for (EdgeIt i(g); i!=INVALID; ++i)
    139     std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
    140   std::cout << std::endl;
    141 }
    142 \endcode
     113\include hello_lemon.cc
    143114
    144115First let us briefly explain how this program works.
     
    160131\c source member functions can be used to access the endpoints of an edge.
    161132
    162 If you have saved the preceding code into a file named, say, \c
    163 hello_lemon.cc and your installation of LEMON into directory \c
    164 /usr/local was successful then it is very easy to compile this
    165 program with the following command (the argument <tt>-lemon</tt>
    166 tells the compiler that we are using the installed library LEMON):
     133If your installation of LEMON into directory \c /usr/local was
     134successful then it is very easy to compile this program with the
     135following command (the argument <tt>-lemon</tt> tells the compiler
     136that we are using the installed library LEMON):
    167137
    168138\verbatim
Note: See TracChangeset for help on using the changeset viewer.