![]() |
Tulip
4.6.0
Better Visualization Through Research
|
00001 /* 00002 * 00003 * This file is part of Tulip (www.tulip-software.org) 00004 * 00005 * Authors: David Auber and the Tulip development Team 00006 * from LaBRI, University of Bordeaux 00007 * 00008 * Tulip is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation, either version 3 00011 * of the License, or (at your option) any later version. 00012 * 00013 * Tulip is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * See the GNU General Public License for more details. 00017 * 00018 */ 00019 ///@cond DOXYGEN_HIDDEN 00020 00021 #include <tulip/Iterator.h> 00022 #include <tulip/tulipconf.h> 00023 #include <tulip/Edge.h> 00024 #include <list> 00025 #include <vector> 00026 00027 #ifndef DOXYGEN_NOTFOR_DEVEL 00028 #ifndef TULIP_NODEMAPITERATOR_H 00029 #define TULIP_NODEMAPITERATOR_H 00030 00031 namespace tlp { 00032 00033 struct node; 00034 class Graph; 00035 00036 /** 00037 * That function enables to obtain the next edge on a face of the embedding. It uses 00038 * the EdgeMapIterators. 00039 * 00040 * @see NodeMapIterator 00041 * @see EdgeMapIterator 00042 * @see PlanarConMap 00043 */ 00044 TLP_SCOPE edge nextFaceEdge(Graph* g, edge source, node target); 00045 00046 /** 00047 * @class NodeMapIterator 00048 * @brief Iterator that enables to traverse the graph taking into account the ordering of edges aroung nodes 00049 * @param sg the considered graph 00050 * @param source the node from witch one arrives on target 00051 * @param target the node the considered node (one will obtain an iterator on the neighboors of that node) 00052 * 00053 * Since Tulip enables to order the edges around nodes, it is possible to traverse the nodes according 00054 * to that ordering. It is necessary to use that function if one wants to take into account the embedding 00055 * of the graph. Such functionnality is really useful when dealing with planar graphs. However if one wants 00056 * more efficient data structure for planar graphs one should consider using PlanarConMap. 00057 * 00058 * @see EdgeMapIterator 00059 * @see PlanarConMap 00060 */ 00061 struct TLP_SCOPE NodeMapIterator : public Iterator<node> { 00062 /// 00063 NodeMapIterator(Graph *sg, node source, node target); 00064 ~NodeMapIterator(); 00065 ///Return the next element 00066 node next(); 00067 ///Return true if it exist a next element 00068 bool hasNext(); 00069 00070 private : 00071 std::list<node> cloneIt; 00072 std::list<node>::iterator itStl; 00073 }; 00074 00075 /** 00076 * @class EdgeMapIterator 00077 * @brief Iterator that enables to traverse the graph taking into account the ordering of edges aroung nodes 00078 * @param sg the considered graph 00079 * @param source the edge from witch one arrives on target 00080 * @param target the node the considered node (one will obtain an iterator on the neighboors of that node) 00081 * 00082 * Since Tulip enables to order the edges around nodes, it is possible to traverse the nodes according 00083 * to that ordering. It is necessary to use that function if one wants to take into account the embedding 00084 * of the graph. Such functionnality is really useful when dealing with planar graphs. However if one wants 00085 * more efficient data structure for planar graphs one should consider using PlanarConMap. 00086 * 00087 * @see EdgeMapIterator 00088 * @see PlanarConMap 00089 */ 00090 struct TLP_SCOPE EdgeMapIterator : public Iterator<edge> { 00091 /// 00092 EdgeMapIterator(const Graph *sg, edge source, node target); 00093 ///Return the next element 00094 edge next(); 00095 ///Return true if it exist a next element 00096 bool hasNext(); 00097 00098 private : 00099 std::vector<edge> adj; 00100 edge start; 00101 int treat; 00102 unsigned int pos; 00103 bool finished; 00104 }; 00105 00106 00107 } 00108 #endif 00109 #endif //DOXYGEN_NOTFOR_DEVEL 00110 ///@endcond