Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
MapIterator.h
1/*
2 *
3 * This file is part of Tulip (https://tulip.labri.fr)
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
30namespace tlp {
31
32struct node;
33class 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 */
43TLP_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
48 * around 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 neighbors of
52 * that node)
53 *
54 * Since Tulip enables to order the edges around nodes, it is possible to traverse the nodes
55 * according
56 * to that ordering. It is necessary to use that function if one wants to take into account the
57 * embedding
58 * of the graph. Such functionality is really useful when dealing with planar graphs. However if
59 * one wants
60 * more efficient data structure for planar graphs one should consider using PlanarConMap.
61 *
62 * @see EdgeMapIterator
63 * @see PlanarConMap
64 */
65struct TLP_SCOPE NodeMapIterator : public Iterator<node> {
66 ///
67 NodeMapIterator(Graph *sg, node source, node target);
68 ~NodeMapIterator() override;
69 /// Return the next element
70 node next() override;
71 /// Return true if it exist a next element
72 bool hasNext() override;
73
74private:
75 std::list<node> cloneIt;
76 std::list<node>::iterator itStl;
77};
78
79/**
80 * @class EdgeMapIterator
81 * @brief Iterator that enables to traverse the graph taking into account the ordering of edges
82 * around nodes
83 * @param sg the considered graph
84 * @param source the edge from witch one arrives on target
85 * @param target the node the considered node (one will obtain an iterator on the neighbors of
86 * that node)
87 *
88 * Since Tulip enables to order the edges around nodes, it is possible to traverse the nodes
89 * according
90 * to that ordering. It is necessary to use that function if one wants to take into account the
91 * embedding
92 * of the graph. Such functionality is really useful when dealing with planar graphs. However if
93 * one wants
94 * more efficient data structure for planar graphs one should consider using PlanarConMap.
95 *
96 * @see EdgeMapIterator
97 * @see PlanarConMap
98 */
99struct TLP_SCOPE EdgeMapIterator : public Iterator<edge> {
100 ///
101 EdgeMapIterator(const Graph *sg, edge source, node target);
102 /// Return the next element
103 edge next() override;
104 /// Return true if it exist a next element
105 bool hasNext() override;
106
107private:
108 std::vector<edge> adj;
109 edge start;
110 int treat;
111 unsigned int pos;
112 bool finished;
113};
114} // namespace tlp
115#endif
116
117///@endcond