Tulip  5.3.0
Large graphs analysis and drawing
Ordering.h
1 /*
2  *
3  * This file is part of Tulip (http://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 #ifndef ORDERING_H
22 #define ORDERING_H
23 #include <tulip/Face.h>
24 //#include <tulip/PlanarConMap.h>
25 #include <tulip/Node.h>
26 #include <tulip/Edge.h>
27 //#include <vector>
28 //#include <map>
29 
30 #include <tulip/MutableContainer.h>
31 
32 namespace tlp {
33 class PluginProgress;
34 class PlanarConMap;
35 
36 class TLP_SCOPE Ordering {
37 public:
38  typedef struct FaceAndPos_ {
39  Face face;
40  node n_first;
41  node n_last;
42  } FaceAndPos;
43 
44  std::vector<edge> getDummyEdges() {
45  return dummy_edge;
46  }
47 
48  Ordering(PlanarConMap *G, PluginProgress *pluginProgress = nullptr, int minProgress = 0,
49  int deltaProgress = 0, int maxProgress = 0);
50  ~Ordering();
51  // inline void push_back(std::vector<node> nodeVector) {
52  inline size_t size() {
53  return _data.size();
54  }
55  inline std::vector<node> operator[](const unsigned int i) const {
56  return _data[i];
57  }
58  inline std::vector<node> &operator[](const unsigned int i) {
59  return _data[i];
60  }
61 
62 private:
63  std::vector<std::vector<node>> _data;
64  PlanarConMap *Gp;
65  MutableContainer<int> oute;
66  MutableContainer<int> outv;
67  MutableContainer<bool> visitedNodes;
68  MutableContainer<bool> visitedFaces;
69  MutableContainer<bool> markedFaces;
70  MutableContainer<int> seqP;
71  MutableContainer<bool> isOuterFace;
72  MutableContainer<bool> contour;
73  MutableContainer<bool> is_selectable;
74  MutableContainer<bool> is_selectable_visited;
75  MutableContainer<bool> is_selectable_face;
76  MutableContainer<bool> is_selectable_visited_face;
77  MutableContainer<node> left;
78  MutableContainer<node> right;
79  bool existMarkedF;
80  FaceAndPos minMarkedFace;
81  Face ext;
82  std::vector<node> v1;
83  std::vector<edge> dummy_edge;
84 
85  node getLastOfQ(Face f, node prec, node n, edge e);
86  node getLastOfP(Face f, node prec, node n, edge e);
87  std::vector<node> getPathFrom(std::vector<node> fn, int from);
88  int infFaceSize();
89 
90  void updateOutAndVisitedFaces(Face f);
91  void updateContourLeftRight(node prec, node n, edge e, node last);
92  void updateNewSelectableNodes(node node_f, node no_tmp2, edge ed_tmp, node node_last,
93  std::vector<Face> v_faces, bool one_face = false,
94  bool was_visited = false, bool selection_face = false);
95  void updateSelectableFaces(std::vector<Face> v_faces);
96 
97  int seqp(Face f);
98  void minMarkedf();
99  void setMinMarkedFace(Face f);
100 
101  struct augmentableAndNodes_ getAugAndNodes(Face f);
102  void augment(Face f, node prec, node n, node prec_last, node last, int nbNewFace, bool pair);
103  void selectAndUpdate(Face f);
104  void selectAndUpdate(node n);
105  bool isSelectable(node n);
106 
107  void init();
108  void init_v1(std::vector<node> fn);
109  void init_selectableNodes();
110  void init_selectableFaces();
111  void init_outv_oute();
112  void init_seqP();
113  void init_outerface();
114 };
115 } // namespace tlp
116 #endif
117 
118 ///@endcond