Tulip  4.4.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
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 1 and Inria Bordeaux - Sud Ouest
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 DOXYGEN_NOTFOR_DEVEL
28 #ifndef TULIP_NODEMAPITERATOR_H
29 #define TULIP_NODEMAPITERATOR_H
30 
31 namespace tlp {
32 
33 struct node;
34 class Graph;
35 
36 /**
37  * That function enables to obtain the next edge on a face of the embedding. It uses
38  * the EdgeMapIterators.
39  *
40  * @see NodeMapIterator
41  * @see EdgeMapIterator
42  * @see PlanarConMap
43  */
44 TLP_SCOPE edge nextFaceEdge(Graph* g, edge source, node target);
45 
46 /**
47  * @class NodeMapIterator
48  * @brief Iterator that enables to traverse the graph taking into account the ordering of edges aroung nodes
49  * @param sg the considered graph
50  * @param source the node from witch one arrives on target
51  * @param target the node the considered node (one will obtain an iterator on the neighboors of that node)
52  *
53  * Since Tulip enables to order the edges around nodes, it is possible to traverse the nodes according
54  * to that ordering. It is necessary to use that function if one wants to take into account the embedding
55  * of the graph. Such functionnality is really useful when dealing with planar graphs. However if one wants
56  * more efficient data structure for planar graphs one should consider using PlanarConMap.
57  *
58  * @see EdgeMapIterator
59  * @see PlanarConMap
60  */
61 struct TLP_SCOPE NodeMapIterator : public Iterator<node> {
62  ///
63  NodeMapIterator(Graph *sg, node source, node target);
64  ~NodeMapIterator();
65  ///Return the next element
66  node next();
67  ///Return true if it exist a next element
68  bool hasNext();
69 
70 private :
71  std::list<node> cloneIt;
72  std::list<node>::iterator itStl;
73 };
74 
75 /**
76  * @class EdgeMapIterator
77  * @brief Iterator that enables to traverse the graph taking into account the ordering of edges aroung nodes
78  * @param sg the considered graph
79  * @param source the edge from witch one arrives on target
80  * @param target the node the considered node (one will obtain an iterator on the neighboors of that node)
81  *
82  * Since Tulip enables to order the edges around nodes, it is possible to traverse the nodes according
83  * to that ordering. It is necessary to use that function if one wants to take into account the embedding
84  * of the graph. Such functionnality is really useful when dealing with planar graphs. However if one wants
85  * more efficient data structure for planar graphs one should consider using PlanarConMap.
86  *
87  * @see EdgeMapIterator
88  * @see PlanarConMap
89  */
90 struct TLP_SCOPE EdgeMapIterator : public Iterator<edge> {
91  ///
92  EdgeMapIterator(const Graph *sg, edge source, node target);
93  ///Return the next element
94  edge next();
95  ///Return true if it exist a next element
96  bool hasNext();
97 
98 private :
99  std::vector<edge> adj;
100  edge start;
101  int treat;
102  unsigned int pos;
103  bool finished;
104 };
105 
106 
107 }
108 #endif
109 #endif //DOXYGEN_NOTFOR_DEVEL
110 ///@endcond