Changeset 1175:6205eebd62fc in lemon-0.x
- Timestamp:
- 02/24/05 18:04:49 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1581
- Location:
- doc
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/Doxyfile
r1172 r1175 446 446 447 447 INPUT = mainpage.dox \ 448 getstart.dox \ 448 449 quicktour.dox \ 449 450 demoprograms.dox \ -
doc/demoprograms.dox
r1170 r1175 3 3 \page demoprograms Demo Programs 4 4 5 6 7 5 8 */ -
doc/getstart.dox
r1173 r1175 2 2 \page getstart How to start using LEMON 3 3 4 In this page we detail how to start using LEMON, from downloading it to 5 your computer, through the steps of installation to showing a simple 6 "Hello World" type program that already uses LEMON. If anything is not 7 clear write to our FAQ. 8 9 \todo Is this FAQ thing a good idea here? Is there such a thing? If 10 twice YES then a link comes here. 11 12 13 14 4 15 \section downloadLEMON How to download LEMON 5 16 6 You can download LEMON from ... 17 You can download LEMON from the following web site: 18 7 19 8 20 \section installLEMON How to install LEMON … … 10 22 In order to install LEMON you have to do the following 11 23 24 Ide kell írni: 25 26 -Hol fordul (Windows-os fordító nem fordítja, unix/linux alatt gcc hanyas verziója kell) 27 - 28 12 29 \section helloworld My first program using LEMON 13 30 14 Helloworld program 15 Link to quicktour 31 If you have installed LEMON on your system you can paste the following code 32 segment into a file to have a first working program that uses library LEMON. 33 34 \code 35 #include <iostream> 36 #include <lemon/list_graph.h> 37 38 using namespace lemon; 39 40 int main() 41 { 42 typedef ListGraph Graph; 43 typedef Graph::Edge Edge; 44 typedef Graph::InEdgeIt InEdgeIt; 45 typedef Graph::OutEdgeIt OutEdgeIt; 46 typedef Graph::EdgeIt EdgeIt; 47 typedef Graph::Node Node; 48 typedef Graph::NodeIt NodeIt; 49 50 Graph g; 51 52 for (int i = 0; i < 3; i++) 53 g.addNode(); 54 55 for (NodeIt i(g); i!=INVALID; ++i) 56 for (NodeIt j(g); j!=INVALID; ++j) 57 if (i != j) g.addEdge(i, j); 58 59 std::cout << "Nodes:"; 60 for (NodeIt i(g); i!=INVALID; ++i) 61 std::cout << " " << g.id(i); 62 std::cout << std::endl; 63 64 std::cout << "Edges:"; 65 for (EdgeIt i(g); i!=INVALID; ++i) 66 std::cout << " (" << g.id(g.source(i)) << "," << g.id(g.target(i)) << ")"; 67 std::cout << std::endl; 68 69 \endcode 70 71 72 ListGraph is one of LEMON's graph classes. It is based on linked lists, 73 therefore iterating throuh its edges and nodes is fast. 74 75 After some convenient typedefs we create a graph and add three nodes to it. 76 Then we add edges to it to form a complete graph. 77 78 Then we iterate through all nodes of the graph. We use a constructor of the 79 node iterator to initialize it to the first node. The operator++ is used to 80 step to the next node. Using operator++ on the iterator pointing to the last 81 node invalidates the iterator i.e. sets its value to 82 \ref lemon::INVALID "INVALID". This is what we exploit in the stop condition. 83 84 We can also iterate through all edges of the graph very similarly. The 85 \c target and 86 \c source member functions can be used to access the endpoints of an edge. 87 88 The previous code fragment prints out the following: 89 90 \code 91 Nodes: 2 1 0 92 93 Edges: (0,2) (1,2) (0,1) (2,1) (1,0) (2,0) 94 \endcode 95 96 97 If you want to see more features, go to the \ref quicktour "Quick Tour to 98 LEMON", if you want to see see some demo programs then go to our 99 \ref demoprograms "Demo Programs" page! 16 100 17 101 -
doc/quicktour.dox
r1170 r1175 3 3 \page quicktour Quick Tour to LEMON 4 4 5 Let us first answer the question <b>"What do I want to use LEMON for?" 6 </b>. 7 LEMON is a C++ library, so you can use it if you want to write C++ 8 programs. What kind of tasks does the library LEMON help to solve? 9 It helps to write programs that solve optimization problems that arise 10 frequently when <b>designing and testing certain networks</b>, for example 11 in telecommunication, computer networks, and other areas that I cannot 12 think of now. A very natural way of modelling these networks is by means 13 of a <b> graph</b> (we will always mean a directed graph by that). 14 So if you want to write a program that works with 15 graphs then you might find it useful to use our library LEMON. 16 17 18 19 Some examples are the following: 20 21 - First we give two examples that show how to instantiate a graph. The 22 first one shows the methods that add nodes and edges, but one will 23 usually use the second way which reads a graph from a stream (file). 24 25 26 -# The following code fragment shows how to fill a graph with data. 27 28 \code 29 30 typedef ListGraph Graph; 31 typedef Graph::Edge Edge; 32 typedef Graph::InEdgeIt InEdgeIt; 33 typedef Graph::OutEdgeIt OutEdgeIt; 34 typedef Graph::EdgeIt EdgeIt; 35 typedef Graph::Node Node; 36 typedef Graph::NodeIt NodeIt; 37 38 Graph g; 39 40 for (int i = 0; i < 3; i++) 41 g.addNode(); 42 43 for (NodeIt i(g); i!=INVALID; ++i) 44 for (NodeIt j(g); j!=INVALID; ++j) 45 if (i != j) g.addEdge(i, j); 46 47 \endcode 48 49 -# 50 51 - If you want to solve some transportation problems in a network then 52 you will want to find shortest paths between nodes of a graph. This is 53 usually solved using Dijkstra's algorithm. A utility 54 that solves this is the \ref lemon::Dijkstra "LEMON Dijkstra class". 55 A simple program using the \ref lemon::Dijkstra "LEMON Dijkstra class" is 56 as follows (we assume that the graph is already given in the memory): 57 58 \code 59 60 \endcode 61 62 - If you want to design a network and want to minimize the total length 63 of wires then you might be looking for a <b>minimum spanning tree</b> in 64 an undirected graph. This can be found using the Kruskal algorithm: the 65 class \ref lemon::Kruskal "LEMON Kruskal class" does this job for you. 66 The following code fragment shows an example: 67 68 \code 69 70 \endcode 71 72 73 74 Some more detailed introduction can be obtained by following the links 75 below: 76 5 77 \ref graphs "Graph structures" 6 play a central role in LEMON, so if you are new to it,78 play a central role in LEMON, so if you are new to the library, 7 79 you probably should start \ref graphs "here". 8 You can also find that page along with others under9 <a class="el" href="pages.html"> Related Pages </a>. 80 (You can also find that page along with others under 81 <a class="el" href="pages.html"> Related Pages </a>.) 10 82 11 83 If you are
Note: See TracChangeset
for help on using the changeset viewer.