athos@1173: /** athos@1173: \page getstart How to start using LEMON athos@1173: athos@1175: In this page we detail how to start using LEMON, from downloading it to athos@1175: your computer, through the steps of installation to showing a simple athos@1175: "Hello World" type program that already uses LEMON. If anything is not athos@1175: clear write to our FAQ. athos@1175: athos@1175: \todo Is this FAQ thing a good idea here? Is there such a thing? If athos@1175: twice YES then a link comes here. athos@1175: athos@1175: athos@1175: athos@1173: \section downloadLEMON How to download LEMON athos@1173: athos@1511: You can download LEMON from the LEMON web site: athos@1511: http://lemon.cs.elte.hu athos@1511: by following the download link. There you will find the issued distributions in form of \e .ta.gz 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. athos@1175: athos@1173: athos@1173: \section installLEMON How to install LEMON athos@1173: athos@1173: In order to install LEMON you have to do the following athos@1173: athos@1511: Download the tarball and issue the following commands: athos@1511: athos@1511: \code athos@1511: tar xvzf lemon-0.3.1.tar.gz athos@1511: cd lemon-0.3.1 athos@1511: ./configure athos@1511: make athos@1511: make check (This is optional, but recomended. It runs a bunch of tests.) athos@1511: make install athos@1511: \endcode athos@1511: athos@1511: These commands install LEMON under /usr/local. If you want to install it to some other place, then pass the --prefix=DIR flag to ./configure. athos@1511: athos@1175: Ide kell írni: athos@1175: athos@1175: -Hol fordul (Windows-os fordító nem fordítja, unix/linux alatt gcc hanyas verziója kell) athos@1175: - athos@1175: athos@1173: \section helloworld My first program using LEMON athos@1173: athos@1175: If you have installed LEMON on your system you can paste the following code athos@1175: segment into a file to have a first working program that uses library LEMON. athos@1173: athos@1175: \code athos@1175: #include athos@1175: #include athos@1173: athos@1175: using namespace lemon; athos@1175: athos@1175: int main() athos@1175: { athos@1175: typedef ListGraph Graph; athos@1175: typedef Graph::Edge Edge; athos@1175: typedef Graph::InEdgeIt InEdgeIt; athos@1175: typedef Graph::OutEdgeIt OutEdgeIt; athos@1175: typedef Graph::EdgeIt EdgeIt; athos@1175: typedef Graph::Node Node; athos@1175: typedef Graph::NodeIt NodeIt; athos@1175: athos@1175: Graph g; athos@1175: athos@1175: for (int i = 0; i < 3; i++) athos@1175: g.addNode(); athos@1175: athos@1175: for (NodeIt i(g); i!=INVALID; ++i) athos@1175: for (NodeIt j(g); j!=INVALID; ++j) athos@1175: if (i != j) g.addEdge(i, j); athos@1175: athos@1175: std::cout << "Nodes:"; athos@1175: for (NodeIt i(g); i!=INVALID; ++i) athos@1175: std::cout << " " << g.id(i); athos@1175: std::cout << std::endl; athos@1175: athos@1175: std::cout << "Edges:"; athos@1175: for (EdgeIt i(g); i!=INVALID; ++i) athos@1175: std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")"; athos@1175: std::cout << std::endl; athos@1175: athos@1175: \endcode athos@1175: athos@1175: athos@1175: ListGraph is one of LEMON's graph classes. It is based on linked lists, athos@1175: therefore iterating throuh its edges and nodes is fast. athos@1175: athos@1175: After some convenient typedefs we create a graph and add three nodes to it. athos@1175: Then we add edges to it to form a complete graph. athos@1175: athos@1175: Then we iterate through all nodes of the graph. We use a constructor of the athos@1175: node iterator to initialize it to the first node. The operator++ is used to athos@1175: step to the next node. Using operator++ on the iterator pointing to the last athos@1175: node invalidates the iterator i.e. sets its value to athos@1175: \ref lemon::INVALID "INVALID". This is what we exploit in the stop condition. athos@1175: athos@1175: We can also iterate through all edges of the graph very similarly. The athos@1175: \c target and athos@1175: \c source member functions can be used to access the endpoints of an edge. athos@1175: athos@1175: The previous code fragment prints out the following: athos@1175: athos@1175: \code athos@1175: Nodes: 2 1 0 athos@1175: athos@1175: Edges: (0,2) (1,2) (0,1) (2,1) (1,0) (2,0) athos@1175: \endcode athos@1175: athos@1175: athos@1175: If you want to see more features, go to the \ref quicktour "Quick Tour to athos@1175: LEMON", if you want to see see some demo programs then go to our athos@1175: \ref demoprograms "Demo Programs" page! athos@1175: athos@1175: athos@1175: */