Changeset 2288:ef8af928c54e in lemon-0.x for doc/basic_concepts.dox
- Timestamp:
- 10/31/06 16:57:53 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3053
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/basic_concepts.dox
r2195 r2288 3 3 4 4 \section basic_graph The graph classes 5 The most important classes in LEMON are the graph classes. A instance of a graph5 The most important classes in LEMON are the graph classes. An instance of a graph 6 6 class is the representation of the mathematical graph. It holds the topology and 7 7 every structural information of the graph. The structural manipulations are also … … 9 9 different classes for different purposes. They can differ in many ways, but all 10 10 have to satisfy one or more \ref concept "graph concepts" which are standardized 11 interfaces to work w hitthe rest of the library. The most basic concept is the11 interfaces to work with the rest of the library. The most basic concept is the 12 12 \ref Graph.<br> 13 13 A good example is the \ref ListGraph which we already know from Hello World and … … 27 27 If the graph fits the ExtendableGraphComponent concept, then you can add new nodes 28 28 to the graph with the addNode() member function. It returns the newly added node 29 (as value). So if you need the new node to do something useful with it, for example30 create a edge, assign a value to it through \ref map1 maps.29 (as value). So if you need the new node to do something useful with, for example 30 create an edge, assign a value to it through \ref map1 maps. 31 31 \code lemon::ListGraph::Node new_node = graph.addNode(); \endcode 32 32 33 If the graph fits the ErasableGraphComponent concept you also canremove nodes33 If the graph fits into the ErasableGraphComponent concept you can also remove nodes 34 34 from the graph with the erase() member function. 35 35 \code graph.erase( new_node ); \endcode … … 44 44 \subsection basic_edge Edges 45 45 An Edge is what you think it is. It goes from one node to another node (they can 46 be identical ). If the graph class is directed, the Edge is directed too. Otherwise46 be identical if the edge is a loop). If the graph class is directed, the Edge is directed too. Otherwise 47 47 the edge is considered undirected and called UEdge. 48 48 \code lemon::ListUGraph::UEdge \endcode … … 51 51 source node and the target node. The graph class must be extendable. 52 52 \code lemon::ListGraph::Edge new_edge = graph.addEdge( src_node, trg_node ); \endcode 53 You can handle edge similar as nodes. The erase() member function has an edge taking53 You can handle edges similar as nodes. The erase() member function has an edge taking 54 54 overload too. 55 55 … … 65 65 \section basic_iterators Iterators 66 66 Graphs are some kind of containers. And as you expect they have iterator types. 67 One for enodes and a couple for edges - and special classes can have additional67 One for nodes and a couple for edges - and special classes can have additional 68 68 iterators too. An example: 69 69 \code lemon::ListGraph::NodeIt \endcode 70 Th at is a node iterator. Every iterator type starts whit an name what refers to71 the iterated object, and ends w hit'It'.70 This is a node iterator. Every iterator type starts with a name that refers to 71 the iterated object, and ends with 'It'. 72 72 73 LEMON style iterators differ sfrom \c stl or \c boost iterators in a very tasty73 LEMON style iterators differ from \c stl or \c boost iterators in a very tasty 74 74 way. A graph has no begin or end - or at least a generic graph class has none. 75 75 If by some topology you could pick a good begin node, it would be misleading and … … 81 81 \code 82 82 for( ListGraph::NodeIt n(graph); n != INVALID; ++n ) 83 do_useful_things_w hit_node(n);83 do_useful_things_with_node(n); 84 84 \endcode 85 85 Note that the function \c do_useful_things_with_node() expects a Node type argument … … 90 90 91 91 <b>Very important!</b> The iteration has no defined order. There is absolutely no 92 guaranty that the next time the iteration will give us the nodes in the same order.92 warranty that the next time the iteration will give us the nodes in the same order. 93 93 Don't use this order to identify nodes! Use the \c id() member function of the 94 94 graph class described above. (There is a powerful technique using maps right in
Note: See TracChangeset
for help on using the changeset viewer.