[Lemon-commits] [lemon_svn] klao: r2005 - in hugo/trunk: demo doc
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:49:27 CET 2006
Author: klao
Date: Mon Jun 27 22:44:29 2005
New Revision: 2005
Added:
hugo/trunk/demo/hello_lemon.cc
Modified:
hugo/trunk/demo/ (props changed)
hugo/trunk/demo/Makefile.am
hugo/trunk/doc/getstart.dox
Log:
getstart: hello_lemon.cc moved to a separate file in demo/
Modified: hugo/trunk/demo/Makefile.am
==============================================================================
--- hugo/trunk/demo/Makefile.am (original)
+++ hugo/trunk/demo/Makefile.am Mon Jun 27 22:44:29 2005
@@ -8,6 +8,7 @@
dim_to_lgf \
graph_to_eps_demo \
min_route \
+ hello_lemon \
sub_graph_adaptor_demo \
coloring
@@ -30,6 +31,8 @@
min_route_SOURCES = min_route.cc
+hello_lemon_SOURCES = hello_lemon.cc
+
sub_graph_adaptor_demo_SOURCES = \
sub_graph_adaptor_demo.cc \
tight_edge_filter_map.h
Added: hugo/trunk/demo/hello_lemon.cc
==============================================================================
--- (empty file)
+++ hugo/trunk/demo/hello_lemon.cc Mon Jun 27 22:44:29 2005
@@ -0,0 +1,29 @@
+#include <iostream>
+#include <lemon/list_graph.h>
+
+int main()
+{
+ typedef lemon::ListGraph Graph;
+ typedef Graph::EdgeIt EdgeIt;
+ typedef Graph::NodeIt NodeIt;
+ using lemon::INVALID;
+
+ Graph g;
+
+ for (int i = 0; i < 3; i++)
+ g.addNode();
+
+ for (NodeIt i(g); i!=INVALID; ++i)
+ for (NodeIt j(g); j!=INVALID; ++j)
+ if (i != j) g.addEdge(i, j);
+
+ std::cout << "Nodes:";
+ for (NodeIt i(g); i!=INVALID; ++i)
+ std::cout << " " << g.id(i);
+ std::cout << std::endl;
+
+ std::cout << "Edges:";
+ for (EdgeIt i(g); i!=INVALID; ++i)
+ std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
+ std::cout << std::endl;
+}
Modified: hugo/trunk/doc/getstart.dox
==============================================================================
--- hugo/trunk/doc/getstart.dox (original)
+++ hugo/trunk/doc/getstart.dox Mon Jun 27 22:44:29 2005
@@ -106,40 +106,11 @@
\section helloworld My first program using LEMON
If you have installed LEMON on your system you can paste the
-following code segment into a file (named e.g. \c hello_lemon.cc)
-to have a first working program that uses library LEMON.
+following code segment into a file (you can find it as \c
+demo/hello_lemon.cc in the LEMON package) to have a first working
+program that uses library LEMON.
-\code
-#include <iostream>
-#include <lemon/list_graph.h>
-
-int main()
-{
- typedef lemon::ListGraph Graph;
- typedef Graph::EdgeIt EdgeIt;
- typedef Graph::NodeIt NodeIt;
- using lemon::INVALID;
-
- Graph g;
-
- for (int i = 0; i < 3; i++)
- g.addNode();
-
- for (NodeIt i(g); i!=INVALID; ++i)
- for (NodeIt j(g); j!=INVALID; ++j)
- if (i != j) g.addEdge(i, j);
-
- std::cout << "Nodes:";
- for (NodeIt i(g); i!=INVALID; ++i)
- std::cout << " " << g.id(i);
- std::cout << std::endl;
-
- std::cout << "Edges:";
- for (EdgeIt i(g); i!=INVALID; ++i)
- std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
- std::cout << std::endl;
-}
-\endcode
+\include hello_lemon.cc
First let us briefly explain how this program works.
@@ -159,11 +130,10 @@
\c target and
\c source member functions can be used to access the endpoints of an edge.
-If you have saved the preceding code into a file named, say, \c
-hello_lemon.cc and your installation of LEMON into directory \c
-/usr/local was successful then it is very easy to compile this
-program with the following command (the argument <tt>-lemon</tt>
-tells the compiler that we are using the installed library LEMON):
+If your installation of LEMON into directory \c /usr/local was
+successful then it is very easy to compile this program with the
+following command (the argument <tt>-lemon</tt> tells the compiler
+that we are using the installed library LEMON):
\verbatim
g++ hello_lemon.cc -o hello_lemon -lemon
More information about the Lemon-commits
mailing list