1.1 --- a/doc/getstart.dox Thu Feb 24 14:44:17 2005 +0000
1.2 +++ b/doc/getstart.dox Thu Feb 24 17:04:49 2005 +0000
1.3 @@ -1,18 +1,102 @@
1.4 /**
1.5 \page getstart How to start using LEMON
1.6
1.7 +In this page we detail how to start using LEMON, from downloading it to
1.8 +your computer, through the steps of installation to showing a simple
1.9 +"Hello World" type program that already uses LEMON. If anything is not
1.10 +clear write to our FAQ.
1.11 +
1.12 +\todo Is this FAQ thing a good idea here? Is there such a thing? If
1.13 +twice YES then a link comes here.
1.14 +
1.15 +
1.16 +
1.17 +
1.18 \section downloadLEMON How to download LEMON
1.19
1.20 -You can download LEMON from ...
1.21 +You can download LEMON from the following web site:
1.22 +
1.23
1.24 \section installLEMON How to install LEMON
1.25
1.26 In order to install LEMON you have to do the following
1.27
1.28 +Ide kell írni:
1.29 +
1.30 +-Hol fordul (Windows-os fordító nem fordítja, unix/linux alatt gcc hanyas verziója kell)
1.31 +-
1.32 +
1.33 \section helloworld My first program using LEMON
1.34
1.35 -Helloworld program
1.36 -Link to quicktour
1.37 +If you have installed LEMON on your system you can paste the following code
1.38 +segment into a file to have a first working program that uses library LEMON.
1.39
1.40 +\code
1.41 +#include <iostream>
1.42 +#include <lemon/list_graph.h>
1.43
1.44 -*/
1.45 \ No newline at end of file
1.46 +using namespace lemon;
1.47 +
1.48 +int main()
1.49 +{
1.50 + typedef ListGraph Graph;
1.51 + typedef Graph::Edge Edge;
1.52 + typedef Graph::InEdgeIt InEdgeIt;
1.53 + typedef Graph::OutEdgeIt OutEdgeIt;
1.54 + typedef Graph::EdgeIt EdgeIt;
1.55 + typedef Graph::Node Node;
1.56 + typedef Graph::NodeIt NodeIt;
1.57 +
1.58 + Graph g;
1.59 +
1.60 + for (int i = 0; i < 3; i++)
1.61 + g.addNode();
1.62 +
1.63 + for (NodeIt i(g); i!=INVALID; ++i)
1.64 + for (NodeIt j(g); j!=INVALID; ++j)
1.65 + if (i != j) g.addEdge(i, j);
1.66 +
1.67 + std::cout << "Nodes:";
1.68 + for (NodeIt i(g); i!=INVALID; ++i)
1.69 + std::cout << " " << g.id(i);
1.70 + std::cout << std::endl;
1.71 +
1.72 + std::cout << "Edges:";
1.73 + for (EdgeIt i(g); i!=INVALID; ++i)
1.74 + std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")";
1.75 + std::cout << std::endl;
1.76 +
1.77 +\endcode
1.78 +
1.79 +
1.80 +ListGraph is one of LEMON's graph classes. It is based on linked lists,
1.81 +therefore iterating throuh its edges and nodes is fast.
1.82 +
1.83 +After some convenient typedefs we create a graph and add three nodes to it.
1.84 +Then we add edges to it to form a complete graph.
1.85 +
1.86 +Then we iterate through all nodes of the graph. We use a constructor of the
1.87 +node iterator to initialize it to the first node. The operator++ is used to
1.88 +step to the next node. Using operator++ on the iterator pointing to the last
1.89 +node invalidates the iterator i.e. sets its value to
1.90 +\ref lemon::INVALID "INVALID". This is what we exploit in the stop condition.
1.91 +
1.92 +We can also iterate through all edges of the graph very similarly. The
1.93 +\c target and
1.94 +\c source member functions can be used to access the endpoints of an edge.
1.95 +
1.96 +The previous code fragment prints out the following:
1.97 +
1.98 +\code
1.99 +Nodes: 2 1 0
1.100 +
1.101 +Edges: (0,2) (1,2) (0,1) (2,1) (1,0) (2,0)
1.102 +\endcode
1.103 +
1.104 +
1.105 +If you want to see more features, go to the \ref quicktour "Quick Tour to
1.106 +LEMON", if you want to see see some demo programs then go to our
1.107 +\ref demoprograms "Demo Programs" page!
1.108 +
1.109 +
1.110 +*/