Changeset 1520:c2c76e4598f6 in lemon-0.x for doc/getstart.dox
- Timestamp:
- 06/27/05 22:44:29 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2005
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/getstart.dox
r1519 r1520 107 107 108 108 If 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. 109 following code segment into a file (you can find it as \c 110 demo/hello_lemon.cc in the LEMON package) to have a first working 111 program that uses library LEMON. 111 112 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 143 114 144 115 First let us briefly explain how this program works. … … 160 131 \c source member functions can be used to access the endpoints of an edge. 161 132 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): 133 If your installation of LEMON into directory \c /usr/local was 134 successful then it is very easy to compile this program with the 135 following command (the argument <tt>-lemon</tt> tells the compiler 136 that we are using the installed library LEMON): 167 137 168 138 \verbatim
Note: See TracChangeset
for help on using the changeset viewer.