equal
deleted
inserted
replaced
16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 namespace lemon { |
19 namespace lemon { |
20 /** |
20 /** |
21 [PAGE]basics[PAGE] Basic Concepts |
21 [PAGE]sec_basics[PAGE] Basic Concepts |
22 |
22 |
23 Throughout the document we are working with the \ref lemon namespace. |
23 Throughout the document we are working with the \ref lemon namespace. |
24 To save a lot of typing we assume that a |
24 To save a lot of typing we assume that a |
25 |
25 |
26 \code |
26 \code |
27 using namespace lemon; |
27 using namespace lemon; |
28 \endcode |
28 \endcode |
29 |
29 |
30 directive is added to the code at the beginning. |
30 directive is added to the code at the beginning. |
31 |
31 |
32 [SEC]digraphs[SEC] Directed Graphs |
32 [SEC]sec_digraphs[SEC] Directed Graphs |
33 |
33 |
34 This section tells you how to work with a directed graph. We use ListDigraph, |
34 This section tells you how to work with a directed graph. We use ListDigraph, |
35 the most versatile graph structure. |
35 the most versatile graph structure. |
36 |
36 |
37 The nodes and the arcs of a graph are identified by two datatypes called |
37 The nodes and the arcs of a graph are identified by two datatypes called |
70 \code |
70 \code |
71 if(g.source(e)==g.target(e)) |
71 if(g.source(e)==g.target(e)) |
72 std::cout << "This is a loop arc" << std::endl; |
72 std::cout << "This is a loop arc" << std::endl; |
73 \endcode |
73 \endcode |
74 |
74 |
75 [SEC]digraphs_it[SEC] Iterators |
75 |
|
76 [SEC]sec_digraph_it[SEC] Iterators |
76 |
77 |
77 Now assume you want to list the elements of the graph. For this purpose the |
78 Now assume you want to list the elements of the graph. For this purpose the |
78 the graphs provides several iterators. For example for following code will |
79 the graphs provides several iterators. For example for following code will |
79 cound the number of nodes in a graph. |
80 cound the number of nodes in a graph. |
80 |
81 |
140 for(ListDigraph::OutArcIt a(g,start); a!=INVALID; ++a) |
141 for(ListDigraph::OutArcIt a(g,start); a!=INVALID; ++a) |
141 cnt++; |
142 cnt++; |
142 std::cout << "Number of arcs leaving the node 'start': " << cnt << std::endl; |
143 std::cout << "Number of arcs leaving the node 'start': " << cnt << std::endl; |
143 \endcode |
144 \endcode |
144 |
145 |
145 [SEC]maps[SEC] Maps |
146 |
|
147 [SEC]sec_digraph_maps[SEC] Maps |
146 |
148 |
147 The concept of "Maps" is another fundamental part of LEMON. They allow assigning |
149 The concept of "Maps" is another fundamental part of LEMON. They allow assigning |
148 values of any type to the nodes or arcs of a graph. The default maps |
150 values of any type to the nodes or arcs of a graph. The default maps |
149 provided by the graph structures have a couple of nice properties. |
151 provided by the graph structures have a couple of nice properties. |
150 |
152 |