Tulip  5.0.0
Large graphs analysis and drawing
MapIterator.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #include <tulip/Iterator.h>
22 #include <tulip/tulipconf.h>
23 #include <tulip/Edge.h>
24 #include <list>
25 #include <vector>
26 
27 #ifndef TULIP_NODEMAPITERATOR_H
28 #define TULIP_NODEMAPITERATOR_H
29 
30 namespace tlp {
31 
32 struct node;
33 class Graph;
34 
35 /**
36  * That function enables to obtain the next edge on a face of the embedding. It uses
37  * the EdgeMapIterators.
38  *
39  * @see NodeMapIterator
40  * @see EdgeMapIterator
41  * @see PlanarConMap
42  */
43 TLP_SCOPE edge nextFaceEdge(Graph* g, edge source, node target);
44 
45 /**
46  * @class NodeMapIterator
47  * @brief Iterator that enables to traverse the graph taking into account the ordering of edges aroung nodes
48  * @param sg the considered graph
49  * @param source the node from witch one arrives on target
50  * @param target the node the considered node (one will obtain an iterator on the neighboors of that node)
51  *
52  * Since Tulip enables to order the edges around nodes, it is possible to traverse the nodes according
53  * to that ordering. It is necessary to use that function if one wants to take into account the embedding
54  * of the graph. Such functionnality is really useful when dealing with planar graphs. However if one wants
55  * more efficient data structure for planar graphs one should consider using PlanarConMap.
56  *
57  * @see EdgeMapIterator
58  * @see PlanarConMap
59  */
60 struct TLP_SCOPE NodeMapIterator : public Iterator<node> {
61  ///
62  NodeMapIterator(Graph *sg, node source, node target);
63  ~NodeMapIterator();
64  ///Return the next element
65  node next();
66  ///Return true if it exist a next element
67  bool hasNext();
68 
69 private :
70  std::list<node> cloneIt;
71  std::list<node>::iterator itStl;
72 };
73 
74 /**
75  * @class EdgeMapIterator
76  * @brief Iterator that enables to traverse the graph taking into account the ordering of edges aroung nodes
77  * @param sg the considered graph
78  * @param source the edge from witch one arrives on target
79  * @param target the node the considered node (one will obtain an iterator on the neighboors of that node)
80  *
81  * Since Tulip enables to order the edges around nodes, it is possible to traverse the nodes according
82  * to that ordering. It is necessary to use that function if one wants to take into account the embedding
83  * of the graph. Such functionnality is really useful when dealing with planar graphs. However if one wants
84  * more efficient data structure for planar graphs one should consider using PlanarConMap.
85  *
86  * @see EdgeMapIterator
87  * @see PlanarConMap
88  */
89 struct TLP_SCOPE EdgeMapIterator : public Iterator<edge> {
90  ///
91  EdgeMapIterator(const Graph *sg, edge source, node target);
92  ///Return the next element
93  edge next();
94  ///Return true if it exist a next element
95  bool hasNext();
96 
97 private :
98  std::vector<edge> adj;
99  edge start;
100  int treat;
101  unsigned int pos;
102  bool finished;
103 };
104 
105 
106 }
107 #endif
108 
109 ///@endcond
Interface for Tulip iterators. Allows basic iteration operations only.
Definition: Iterator.h:39