Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Graph_d.h
Go to the documentation of this file.
1 
35 #pragma once
36 
37 #include <ogdf/basic/Array.h>
38 #include <ogdf/basic/GraphList.h>
39 #include <ogdf/basic/List.h>
40 #include <ogdf/basic/Observer.h>
42 #include <ogdf/basic/basic.h>
43 #include <ogdf/basic/comparer.h>
47 #include <ogdf/basic/memory.h>
48 
49 #include <algorithm>
50 #include <array>
51 #include <functional>
52 #include <iterator>
53 #include <ostream>
54 #include <utility>
55 
56 #ifdef OGDF_DEBUG
57 # include <set>
58 #endif
59 
60 namespace ogdf {
61 class OGDF_EXPORT AdjElement; // IWYU pragma: keep
62 class OGDF_EXPORT ClusterElement; // IWYU pragma: keep
63 class OGDF_EXPORT EdgeElement; // IWYU pragma: keep
64 class OGDF_EXPORT FaceElement; // IWYU pragma: keep
65 class OGDF_EXPORT Graph; // IWYU pragma: keep
66 class OGDF_EXPORT NodeElement; // IWYU pragma: keep
67 
70 using node = NodeElement*;
71 
74 using edge = EdgeElement*;
75 
79 
80 
81 #if __cpp_concepts >= 201907
82 // clang-format off
83 template<typename T>
84 concept OGDF_NODE_FILTER = requires(T f) {
85  { f(node()) } -> std::convertible_to<bool>;
86 };
87 template<typename T>
88 concept OGDF_EDGE_FILTER = requires(T f) {
89  { f(edge()) } -> std::convertible_to<bool>;
90 };
91 template<typename T>
92 concept OGDF_NODE_ITER = std::forward_iterator<T> && requires(T i) {
93  { *i } -> std::convertible_to<node>;
94 };
95 template<typename T>
96 concept OGDF_EDGE_ITER = std::forward_iterator<T> && requires(T i) {
97  { *i } -> std::convertible_to<edge>;
98 };
99 using std::begin;
100 using std::end;
101 template<typename T>
102 concept OGDF_NODE_LIST = requires(T l) {
103  OGDF_NODE_ITER<decltype(begin(l))>;
104  OGDF_NODE_ITER<decltype(end(l))>;
105 };
106 template<typename T>
107 concept OGDF_EDGE_LIST = requires(T l) {
108  OGDF_EDGE_ITER<decltype(begin(l))>;
109  OGDF_EDGE_ITER<decltype(end(l))>;
110 };
111 // clang-format on
112 
113 # define OGDF_HAS_CONCEPTS
114 # define OGDF_CHECK_CONCEPT static_assert
115 
116 OGDF_CHECK_CONCEPT(OGDF_NODE_ITER<internal::GraphIterator<node>>);
117 OGDF_CHECK_CONCEPT(OGDF_EDGE_ITER<internal::GraphIterator<edge>>);
118 OGDF_CHECK_CONCEPT(OGDF_NODE_ITER<internal::GraphReverseIterator<node>>);
119 OGDF_CHECK_CONCEPT(OGDF_EDGE_ITER<internal::GraphReverseIterator<edge>>);
120 OGDF_CHECK_CONCEPT(OGDF_NODE_LIST<internal::GraphObjectContainer<NodeElement>>);
121 OGDF_CHECK_CONCEPT(OGDF_EDGE_LIST<internal::GraphObjectContainer<EdgeElement>>);
122 OGDF_CHECK_CONCEPT(OGDF_NODE_ITER<ListIteratorBase<node, false, false>>);
123 OGDF_CHECK_CONCEPT(OGDF_EDGE_ITER<ListIteratorBase<edge, false, true>>);
124 OGDF_CHECK_CONCEPT(OGDF_NODE_ITER<ListIteratorBase<node, true, false>>);
125 OGDF_CHECK_CONCEPT(OGDF_EDGE_ITER<ListIteratorBase<edge, true, false>>);
126 #else
127 # define OGDF_NODE_FILTER typename
128 # define OGDF_EDGE_FILTER typename
129 # define OGDF_NODE_ITER typename
130 # define OGDF_EDGE_ITER typename
131 # define OGDF_NODE_LIST typename
132 # define OGDF_EDGE_LIST typename
133 
134 # define OGDF_CHECK_CONCEPT(...)
135 #endif
136 
138 
143  friend class Graph;
146 
150  int m_id;
151 
153  explicit AdjElement(node v) : m_twin(nullptr), m_edge(nullptr), m_node(v), m_id(0) { }
154 
156  AdjElement(edge e, int id) : m_twin(nullptr), m_edge(e), m_node(nullptr), m_id(id) { }
157 
158 public:
160  edge theEdge() const { return m_edge; }
161 
163  operator edge() const { return m_edge; }
164 
166  node theNode() const { return m_node; }
167 
169  operator node() const { return m_node; }
170 
172  adjEntry twin() const { return m_twin; }
173 
175  node twinNode() const { return m_twin->m_node; }
176 
178  int index() const { return m_id; }
179 
181  bool isSource() const;
182 
193  bool isBetween(adjEntry adjBefore, adjEntry adjAfter) const;
194 
195  // traversing faces in clockwise (resp. counter-clockwise) order
196  // (if face is an interior face)
197 
199  adjEntry clockwiseFaceSucc() const { return m_twin->cyclicPred(); }
200 
202  adjEntry clockwiseFacePred() const { return cyclicSucc()->m_twin; }
203 
205  adjEntry counterClockwiseFaceSucc() const { return m_twin->cyclicSucc(); }
206 
208  adjEntry counterClockwiseFacePred() const { return cyclicPred()->m_twin; }
209 
210  // default is traversing faces in clockwise order
212  adjEntry faceCycleSucc() const { return clockwiseFaceSucc(); }
213 
215  adjEntry faceCyclePred() const { return clockwiseFacePred(); }
216 
218  adjEntry succ() const { return static_cast<adjEntry>(m_next); }
219 
221  adjEntry pred() const { return static_cast<adjEntry>(m_prev); }
222 
224  adjEntry cyclicSucc() const;
226  adjEntry cyclicPred() const;
227 
228 #ifdef OGDF_DEBUG
229  const Graph* graphOf() const;
230 #endif
231 
233  static int compare(const AdjElement& x, const AdjElement& y) { return x.m_id - y.m_id; }
235 
237 };
238 
241  friend class Graph;
243 
244  //GraphList<AdjElement> m_adjEdges; //!< The adjacency list of the node.
245  int m_indeg;
246  int m_outdeg;
247  int m_id;
248 
249 #ifdef OGDF_DEBUG
250  // we store the graph containing this node for debugging purposes
251  const Graph* m_pGraph;
252 #endif
253 
254 
256 #ifdef OGDF_DEBUG
257 
262  NodeElement(const Graph* pGraph, int id)
263  : m_indeg(0), m_outdeg(0), m_id(id), m_pGraph(pGraph) { }
264 #else
265  NodeElement(int id) : m_indeg(0), m_outdeg(0), m_id(id) { }
266 #endif
267 
268 
269 public:
272 
274  int index() const { return m_id; }
275 
277  int indeg() const { return m_indeg; }
278 
280  int outdeg() const { return m_outdeg; }
281 
283  int degree() const { return m_indeg + m_outdeg; }
284 
286  adjEntry firstAdj() const { return adjEntries.head(); }
287 
289  adjEntry lastAdj() const { return adjEntries.tail(); }
290 
292  node succ() const { return static_cast<node>(m_next); }
293 
295  node pred() const { return static_cast<node>(m_prev); }
296 
298 
302  template<class ADJLIST>
303  void allAdjEntries(ADJLIST& adjList) const {
304  adjList.clear();
305  for (adjEntry adj : this->adjEntries) {
306  adjList.pushBack(adj);
307  }
308  }
309 
311 
318  template<class EDGELIST>
319  void adjEdges(EDGELIST& edgeList) const {
320  edgeList.clear();
321  for (adjEntry adj : this->adjEntries) {
322  edgeList.pushBack(adj->theEdge());
323  }
324  }
325 
327 
331  template<class EDGELIST>
332  void inEdges(EDGELIST& edgeList) const;
333 
335 
339  template<class EDGELIST>
340  void outEdges(EDGELIST& edgeList) const;
341 
342 #ifdef OGDF_DEBUG
343  const Graph* graphOf() const { return m_pGraph; }
345 #endif
346 
348  static int compare(const NodeElement& x, const NodeElement& y) { return x.m_id - y.m_id; }
350 
352 };
353 
355  return (m_next) ? static_cast<adjEntry>(m_next) : m_node->firstAdj();
356 }
357 
359  return (m_prev) ? static_cast<adjEntry>(m_prev) : m_node->lastAdj();
360 }
361 
364  friend class Graph;
366 
371  int m_id; // The (unique) index of the edge.
372 
374 
381  EdgeElement(node src, node tgt, AdjElement* adjSrc, AdjElement* adjTgt, int id)
382  : m_src(src), m_tgt(tgt), m_adjSrc(adjSrc), m_adjTgt(adjTgt), m_id(id) { }
383 
385 
390  EdgeElement(node src, node tgt, int id)
391  : m_src(src), m_tgt(tgt), m_adjSrc(nullptr), m_adjTgt(nullptr), m_id(id) { }
392 
393 public:
395  int index() const { return m_id; }
396 
398  node source() const { return m_src; }
399 
401  node target() const { return m_tgt; }
402 
404  std::array<node, 2> nodes() const { return std::array<node, 2> {{m_src, m_tgt}}; }
405 
407  adjEntry adjSource() const { return m_adjSrc; }
408 
410  adjEntry adjTarget() const { return m_adjTgt; }
411 
413  node opposite(node v) const {
414  OGDF_ASSERT(isIncident(v));
415  return v == m_src ? m_tgt : m_src;
416  }
417 
419  bool isSelfLoop() const { return m_src == m_tgt; }
420 
422  bool isInvertedDirected(edge e) const { return m_src == e->target() && m_tgt == e->source(); }
423 
425  bool isParallelDirected(edge e) const { return m_src == e->source() && m_tgt == e->target(); }
426 
428  bool isParallelUndirected(edge e) const {
429  return isParallelDirected(e) || isInvertedDirected(e);
430  }
431 
433  edge succ() const { return static_cast<edge>(m_next); }
434 
436  edge pred() const { return static_cast<edge>(m_prev); }
437 
438 #ifdef OGDF_DEBUG
439  const Graph* graphOf() const { return m_src->graphOf(); }
441 #endif
442 
444  bool isIncident(node v) const { return v == m_src || v == m_tgt; }
445 
447  bool isAdjacent(edge e) const { return isIncident(e->m_src) || isIncident(e->m_tgt); }
448 
450  node commonNode(edge e) const {
451  return (m_src == e->m_src || m_src == e->m_tgt)
452  ? m_src
453  : ((m_tgt == e->m_src || m_tgt == e->m_tgt) ? m_tgt : nullptr);
454  }
455 
458  adjEntry getAdj(node v) const {
459  OGDF_ASSERT(this->isIncident(v));
460  return v == m_src ? m_adjSrc : m_adjTgt;
461  }
462 
464  static int compare(const EdgeElement& x, const EdgeElement& y) { return x.m_id - y.m_id; }
466 
468 
469 #ifdef OGDF_DEBUG
470 private:
471  bool m_hidden = false;
472 #endif
473 };
474 
475 #ifdef OGDF_DEBUG
476 inline const Graph* AdjElement::graphOf() const { return m_node->graphOf(); }
477 #endif
478 
479 inline bool AdjElement::isSource() const { return this == m_edge->adjSource(); }
480 
481 inline bool AdjElement::isBetween(adjEntry adjBefore, adjEntry adjAfter) const {
482 #ifdef OGDF_DEBUG
483  node v = this->theNode();
484  OGDF_ASSERT(adjBefore->theNode() == v);
485  OGDF_ASSERT(adjAfter->theNode() == v);
486 #endif
487  bool result = this != adjBefore && this != adjAfter && adjBefore != adjAfter;
488 
489  if (result) {
490  adjEntry adj = adjBefore;
491  for (; adj != this && adj != adjAfter; adj = adj->cyclicSucc()) {
492  ;
493  }
494  result = adj == this;
495  }
496 
497  return result;
498 }
499 
500 template<class EDGELIST>
501 void NodeElement::inEdges(EDGELIST& edgeList) const {
502  edgeList.clear();
503  for (adjEntry adj : this->adjEntries) {
504  edge e = adj->theEdge();
505  if (adj == e->adjTarget()) {
506  edgeList.pushBack(e);
507  }
508  }
509 }
510 
511 template<class EDGELIST>
512 void NodeElement::outEdges(EDGELIST& edgeList) const {
513  edgeList.clear();
514  for (adjEntry adj : this->adjEntries) {
515  edge e = adj->theEdge();
516  if (adj == e->adjSource()) {
517  edgeList.pushBack(e);
518  }
519  }
520 }
521 
526 
527 public:
530 
532  GraphAdjIterator(Graph* graph = nullptr, adjEntry entry = nullptr);
533 
536 
538  GraphAdjIterator end() { return GraphAdjIterator(m_pGraph); }
539 
541  void next();
542 
544  void prev();
545 
547  adjEntry operator*() const { return m_entry; }
548 
550  AdjElement& operator->() const { return *m_entry; }
551 
553  bool operator==(const GraphAdjIterator& iter) const {
554  return m_pGraph == iter.m_pGraph && m_entry == iter.m_entry;
555  }
556 
558  bool operator!=(const GraphAdjIterator& iter) const { return !operator==(iter); }
559 
562  next();
563  return *this;
564  }
565 
568  GraphAdjIterator iter = *this;
569  next();
570  return iter;
571  }
572 
575  prev();
576  return *this;
577  }
578 
581  GraphAdjIterator iter = *this;
582  prev();
583  return iter;
584  }
585 };
586 
587 namespace internal {
589 
596 template<typename Key, typename Iterable = GraphObjectContainer<Key>, int Factor = 1>
598  : public RegistryBase<Key*, GraphRegistry<Key, Iterable, Factor>, typename Iterable::iterator> {
601 
602 public:
603  using iterator = typename Iterable::iterator;
604 
606  GraphRegistry(Graph* graph, int* nextKeyIndex)
607  : m_pGraph(graph), m_nextKeyIndex(nextKeyIndex) { }
608 
609  static inline int keyToIndex(Key* key) { return key->index(); }
610 
611  bool isKeyAssociated(Key* key) const {
612  if (key == nullptr) {
613  return false;
614  }
615 #ifdef OGDF_DEBUG
616  if (key->graphOf() == m_pGraph) {
617  OGDF_ASSERT(keyToIndex(key) < this->getArraySize());
618  return true;
619  } else {
620  return false;
621  }
622 #else
623  return true;
624 #endif
625  }
626 
627  int calculateArraySize(int add) const {
628  return calculateTableSize((*m_nextKeyIndex + add) * Factor);
629  }
630 
631  int maxKeyIndex() const { return ((*m_nextKeyIndex) * Factor) - 1; }
632 
634  Graph* graphOf() const { return m_pGraph; }
635 };
636 
640 
641 #ifndef DOXYGEN_IGNORE
642 // doxygen has problems keeping these methods apart
644 
646 
648 
650 
652 
654 #endif
655 
657 template<typename Key, typename Value, bool WithDefault, typename Registry = GraphRegistry<Key>>
658 class GraphRegisteredArray : public RegisteredArray<Registry, Value, WithDefault, Graph> {
660 
661 public:
662  using RA::RA;
663 
665  Graph* graphOf() const {
666  if (RA::registeredAt() == nullptr) {
667  return nullptr;
668  } else {
669  return RA::registeredAt()->graphOf();
670  }
671  }
672 };
673 
675 template<typename Value, bool WithDefault>
676 class EdgeArrayBase1 : public GraphRegisteredArray<EdgeElement, Value, WithDefault> {
678 
679 public:
680  using GRA::GRA;
681 
682  using GRA::operator[];
683  using GRA::operator();
684 
686  const Value& operator[](adjEntry adj) const {
687  OGDF_ASSERT(adj != nullptr);
688  OGDF_ASSERT(GRA::getRegistry().isKeyAssociated(adj->theEdge()));
689  return GRA::operator[](adj->index() >> 1);
690  }
691 
693  Value& operator[](adjEntry adj) {
694  OGDF_ASSERT(adj != nullptr);
695  OGDF_ASSERT(GRA::getRegistry().isKeyAssociated(adj->theEdge()));
696  return GRA::operator[](adj->index() >> 1);
697  }
698 
700  const Value& operator()(adjEntry adj) const {
701  OGDF_ASSERT(adj != nullptr);
702  OGDF_ASSERT(GRA::getRegistry().isKeyAssociated(adj->theEdge()));
703  return GRA::operator[](adj->index() >> 1);
704  }
705 
707  Value& operator()(adjEntry adj) {
708  OGDF_ASSERT(adj != nullptr);
709  OGDF_ASSERT(GRA::getRegistry().isKeyAssociated(adj->theEdge()));
710  return GRA::operator[](adj->index() >> 1);
711  }
712 };
713 
715 template<typename Value, bool WithDefault>
716 class EdgeArrayBase2 : public EdgeArrayBase1<Value, WithDefault> {
717 public:
719 };
720 
721 template<bool WithDefault>
722 class EdgeArrayBase2<edge, WithDefault> : public EdgeArrayBase1<edge, WithDefault> {
724 
725 public:
726  using EA::EA;
727 
730  OGDF_ASSERT(adj != nullptr);
731  OGDF_ASSERT(EA::getRegistry().isKeyAssociated(adj->theEdge()));
732  edge e = EA::operator[](adj->index() >> 1);
733  return adj->isSource() ? e->adjSource() : e->adjTarget();
734  }
735 };
736 }
737 
738 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) internal::GraphRegisteredArray<NodeElement, v, c>
741 #undef OGDF_DECL_REG_ARRAY_TYPE
742 
743 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) internal::EdgeArrayBase2<v, c>
746 #undef OGDF_DECL_REG_ARRAY_TYPE
747 
748 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) \
749  internal::GraphRegisteredArray<AdjElement, v, c, internal::GraphAdjRegistry>
752 #undef OGDF_DECL_REG_ARRAY_TYPE
753 
754 template<bool>
755 class EdgeSet;
756 
758 
777 class OGDF_EXPORT GraphObserver : public Observer<Graph, GraphObserver> {
778 public:
780  GraphObserver() = default;
781 
786  explicit GraphObserver(const Graph* G) { reregister(G); }
787 
789  virtual void nodeDeleted(node v) = 0;
790 
792  virtual void nodeAdded(node v) = 0;
793 
795  virtual void edgeDeleted(edge e) = 0;
796 
798  virtual void edgeAdded(edge e) = 0;
799 
801  virtual void cleared() = 0;
802 
803  const Graph* getGraph() const { return getObserved(); }
804 };
805 
806 namespace internal {
807 template<typename CONTAINER>
808 inline void getAllNodes(const Graph& G, CONTAINER& nodes);
809 template<typename CONTAINER>
810 inline void getAllEdges(const Graph& G, CONTAINER& edges);
811 
812 inline node adjToNode(adjEntry adj) { return adj->theNode(); }
813 
814 inline node adjToNode(node n) { return n; }
815 }
816 
818 OGDF_EXPORT bool filter_any_edge(edge e); // { return true; }
819 
821 OGDF_EXPORT bool filter_any_node(node n); // { return true; }
822 
824 
869 class OGDF_EXPORT Graph : public Observable<GraphObserver, Graph> {
870 public:
871  class CCsInfo; // IWYU pragma: keep
872  class HiddenEdgeSet; // IWYU pragma: keep
873 
874  friend class GraphObserver;
875 
876 private:
879 
883 
885 
886 public:
892 
900 
902 
906 
909  enum class EdgeType { association = 0, generalization = 1, dependency = 2 };
910 
912  enum class NodeType {
913  vertex = 0,
914  dummy = 1,
915  generalizationMerger = 2,
916  generalizationExpander = 3,
917  highDegreeExpander = 4,
918  lowDegreeExpander = 5,
919  associationClass = 6
920  };
921 
923 
924 
929 
933 
936 
938 
939 
941  Graph();
942 
944 
953 
955 
965 
967 
969  virtual ~Graph();
970 
972 
976 
979  bool empty() const { return nodes.empty(); }
980 
982  int numberOfNodes() const { return nodes.size(); }
983 
985  int numberOfEdges() const { return edges.size(); }
986 
988  int maxNodeIndex() const { return m_nodeIdCount - 1; }
989 
991  int maxEdgeIndex() const { return m_edgeIdCount - 1; }
992 
994  int maxAdjEntryIndex() const { return (m_edgeIdCount << 1) - 1; }
995 
997  node firstNode() const { return nodes.head(); }
998 
1000  node lastNode() const { return nodes.tail(); }
1001 
1003  edge firstEdge() const { return edges.head(); }
1004 
1006  edge lastEdge() const { return edges.tail(); }
1007 
1015  node chooseNode(
1016  std::function<bool(node)> includeNode = [](node) { return true; },
1017  bool isFastTest = true) const;
1018 
1026  edge chooseEdge(
1027  std::function<bool(edge)> includeEdge = [](edge) { return true; },
1028  bool isFastTest = true) const;
1029 
1031 
1035  template<class CONTAINER>
1036  void allNodes(CONTAINER& nodeContainer) const {
1037  internal::getAllNodes<CONTAINER>(*this, nodeContainer);
1038  }
1039 
1041 
1045  template<class CONTAINER>
1046  void allEdges(CONTAINER& edgeContainer) const {
1047  internal::getAllEdges<CONTAINER>(*this, edgeContainer);
1048  }
1049 
1051 
1054 
1057 
1064  node newNode(int index = -1) {
1065  node v = pureNewNode(index);
1066  m_regNodeArrays.keyAdded(v);
1067  for (GraphObserver* obs : getObservers()) {
1068  obs->nodeAdded(v);
1069  }
1070  return v;
1071  }
1072 
1074 
1083  inline edge newEdge(node v, node w, int index = -1) {
1084  return newEdge(v, Direction::after, w, Direction::after, index);
1085  }
1086 
1088 
1102  inline edge newEdge(node v, adjEntry adjTgt, int index = -1) {
1103  return newEdge(v, Direction::after, adjTgt, Direction::after, index);
1104  }
1105 
1107 
1121  inline edge newEdge(adjEntry adjSrc, node w, int index = -1) {
1122  return newEdge(adjSrc, Direction::after, w, Direction::after, index);
1123  }
1124 
1126 
1143  inline edge newEdge(adjEntry adjSrc, adjEntry adjTgt, Direction dir = Direction::after,
1144  int index = -1) {
1145  return newEdge(adjSrc, dir, adjTgt, dir, index);
1146  }
1147 
1149 
1167  template<typename S, typename T>
1168  edge newEdge(S src, Direction dirSrc, T tgt, Direction dirTgt, int index = -1) {
1169  OGDF_ASSERT(src != nullptr);
1170  OGDF_ASSERT(tgt != nullptr);
1171  edge e = pureNewEdge(internal::adjToNode(src), internal::adjToNode(tgt), index);
1172 
1173  insertAdjEntry(tgt, e->m_adjTgt, dirTgt);
1174  insertAdjEntry(src, e->m_adjSrc, dirSrc);
1175 
1176  m_regEdgeArrays.keyAdded(e);
1177  m_regAdjArrays.keyAdded(e->adjSource());
1178  for (GraphObserver* obs : getObservers()) {
1179  obs->edgeAdded(e);
1180  }
1181 
1182  return e;
1183  }
1184 
1186 
1189 
1192  virtual void delNode(node v);
1193 
1195  virtual void delEdge(edge e);
1196 
1198  virtual void clear();
1199 
1201  void restoreAllEdges();
1202 
1204 
1225  friend class Graph;
1226  friend class EdgeElement;
1227 
1228  public:
1234  explicit HiddenEdgeSet(Graph& graph) : m_graph(&graph) {
1235  m_it = m_graph->m_hiddenEdgeSets.pushFront(this);
1236  }
1237 
1242  if (m_graph) {
1243  restore();
1244  m_graph->m_hiddenEdgeSets.del(m_it);
1245  }
1246  }
1247 
1254  void hide(edge e);
1255 
1262  void restore(edge e);
1263 
1270  void restore();
1271 
1273  int size();
1274 
1276  bool empty();
1277 
1280 
1283 
1284  private:
1288 
1290  };
1291 
1295 
1298 
1307  virtual edge split(edge e);
1308 
1310 
1319  void unsplit(node u);
1320 
1322 
1333  virtual void unsplit(edge eIn, edge eOut);
1334 
1336 
1357  node splitNode(adjEntry adjStartLeft, adjEntry adjStartRight);
1358 
1360 
1368  node contract(edge e, bool keepSelfLoops = false);
1369 
1371 
1385  void move(edge e, adjEntry adjSrc, Direction dirSrc, adjEntry adjTgt, Direction dirTgt);
1386 
1388 
1394  void moveTarget(edge e, node w);
1395 
1397 
1405  void moveTarget(edge e, adjEntry adjTgt, Direction dir);
1406 
1408 
1414  void moveSource(edge e, node w);
1415 
1417 
1425  void moveSource(edge e, adjEntry adjSrc, Direction dir);
1426 
1428 
1436  edge searchEdge(node v, node w, bool directed = false) const;
1437 
1439  void reverseEdge(edge e);
1440 
1442  void reverseAllEdges();
1443 
1445 
1451  template<class NODELIST>
1452  void collapse(NODELIST& nodesToCollapse) {
1453  node v = nodesToCollapse.popFrontRet();
1454  while (!nodesToCollapse.empty()) {
1455  node w = nodesToCollapse.popFrontRet();
1456  adjEntry adj = w->firstAdj();
1457  while (adj != nullptr) {
1458  adjEntry succ = adj->succ();
1459  edge e = adj->theEdge();
1460  if (e->source() == v || e->target() == v) {
1461  delEdge(e);
1462  } else if (e->source() == w) {
1463  moveSource(e, v);
1464  } else {
1465  moveTarget(e, v);
1466  }
1467  adj = succ;
1468  }
1469  delNode(w);
1470  }
1471  }
1472 
1474 
1481  template<class ADJ_ENTRY_LIST>
1482  void sort(node v, const ADJ_ENTRY_LIST& newOrder) {
1483  using std::begin;
1484  using std::end;
1485  sort(v, begin(newOrder), end(newOrder));
1486  }
1487 
1489 
1497  template<class IT>
1498  void sort(node v, IT begin, IT end) {
1499 #ifdef OGDF_DEBUG
1500  std::set<int> entries;
1501  int counter = 0;
1502 
1503  for (auto it = begin; it != end; ++it) {
1504  adjEntry adj = *it;
1505  entries.insert(adj->index());
1506  OGDF_ASSERT(adj->theNode() == v);
1507  counter++;
1508  }
1509 
1510  OGDF_ASSERT(counter == v->degree());
1511  OGDF_ASSERT(entries.size() == static_cast<unsigned int>(v->degree()));
1512 #endif
1513  v->adjEntries.sort(begin, end);
1514  }
1515 
1517 
1520  void reverseAdjEdges(node v) { v->adjEntries.reverse(); }
1521 
1523 
1530  void moveAdj(adjEntry adjMove, Direction dir, adjEntry adjPos) {
1531  OGDF_ASSERT(adjMove != nullptr);
1532  OGDF_ASSERT(adjPos != nullptr);
1533  OGDF_ASSERT(adjMove->graphOf() == this);
1534  OGDF_ASSERT(adjPos->graphOf() == this);
1535  internal::GraphList<AdjElement>& adjList = adjMove->m_node->adjEntries;
1536  adjList.move(adjMove, adjList, adjPos, dir);
1537  }
1538 
1540 
1546  void moveAdjAfter(adjEntry adjMove, adjEntry adjAfter) {
1547  OGDF_ASSERT(adjMove != nullptr);
1548  OGDF_ASSERT(adjAfter != nullptr);
1549  OGDF_ASSERT(adjMove->graphOf() == this);
1550  OGDF_ASSERT(adjAfter->graphOf() == this);
1551  adjMove->m_node->adjEntries.moveAfter(adjMove, adjAfter);
1552  }
1553 
1555 
1561  void moveAdjBefore(adjEntry adjMove, adjEntry adjBefore) {
1562  OGDF_ASSERT(adjMove != nullptr);
1563  OGDF_ASSERT(adjBefore != nullptr);
1564  OGDF_ASSERT(adjMove->graphOf() == this);
1565  OGDF_ASSERT(adjBefore->graphOf() == this);
1566  adjMove->m_node->adjEntries.moveBefore(adjMove, adjBefore);
1567  }
1568 
1570  void reverseAdjEdges();
1571 
1573 
1579  void swapAdjEdges(adjEntry adj1, adjEntry adj2) {
1580  OGDF_ASSERT(adj1->theNode() == adj2->theNode());
1581  OGDF_ASSERT(adj1->graphOf() == this);
1582 
1583  adj1->theNode()->adjEntries.swap(adj1, adj2);
1584  }
1585 
1587 
1590 
1593 
1603  int genus() const;
1604 
1606 
1609  bool representsCombEmbedding() const { return genus() == 0; }
1610 
1611 #ifdef OGDF_DEBUG
1612  void consistencyCheck() const;
1614 #endif
1615 
1617 
1622 
1625  internal::GraphNodeRegistry& nodeRegistry() { return m_regNodeArrays; }
1626 
1628  const internal::GraphNodeRegistry& nodeRegistry() const { return m_regNodeArrays; }
1629 
1630  operator const internal::GraphNodeRegistry&() const { return m_regNodeArrays; }
1631 
1633  internal::GraphEdgeRegistry& edgeRegistry() { return m_regEdgeArrays; }
1634 
1636  const internal::GraphEdgeRegistry& edgeRegistry() const { return m_regEdgeArrays; }
1637 
1638  operator const internal::GraphEdgeRegistry&() const { return m_regEdgeArrays; }
1639 
1641  internal::GraphAdjRegistry& adjEntryRegistry() { return m_regAdjArrays; }
1642 
1644  const internal::GraphAdjRegistry& adjEntryRegistry() const { return m_regAdjArrays; }
1645 
1646  operator const internal::GraphAdjRegistry&() const { return m_regAdjArrays; }
1647 
1649 
1674  void resetEdgeIdCount(int maxId);
1675 
1676  void resetNodeIdCount(int maxId);
1677 
1678 
1680 
1683 
1718  template<OGDF_NODE_ITER NI, OGDF_EDGE_ITER EI, bool copyEmbedding = true, bool copyIDs = false,
1719  bool notifyObservers = true>
1720  std::pair<int, int> insert(const NI& nodesBegin, const NI& nodesEnd, const EI& edgesBegin,
1721  const EI& edgesEnd, NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap);
1722 
1750  template<OGDF_NODE_ITER NI, OGDF_EDGE_FILTER EF, bool copyIDs = false, bool notifyObservers = true>
1751  std::pair<int, int> insert(const NI& nodesBegin, const NI& nodesEnd, const EF& edgeFilter,
1752  NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap);
1753 
1754  // List short-cuts
1755 
1762  template<OGDF_NODE_LIST NL>
1763  std::pair<int, int> insert(const NL& nodeList, const EdgeSet<true>& edgeSet,
1764  NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap);
1765 
1772  template<OGDF_NODE_LIST NL>
1773  std::pair<int, int> insert(const NL& nodeList, const EdgeSet<false>& edgeSet,
1774  NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap);
1775 
1782  template<OGDF_NODE_LIST NL, OGDF_EDGE_LIST EL>
1783  std::pair<int, int> insert(const NL& nodeList, const EL& edgeList, NodeArray<node>& nodeMap,
1784  EdgeArray<edge>& edgeMap) {
1785  m_regNodeArrays.reserveSpace(nodeList.size());
1786  m_regEdgeArrays.reserveSpace(edgeList.size());
1787  m_regAdjArrays.reserveSpace(edgeList.size());
1788  using std::begin;
1789  using std::end;
1790  return insert(begin(nodeList), end(nodeList), begin(edgeList), end(edgeList), nodeMap,
1791  edgeMap);
1792  }
1793 
1794  // Often-used special cases
1795 
1802  std::pair<int, int> insert(const CCsInfo& info, int cc, NodeArray<node>& nodeMap,
1803  EdgeArray<edge>& edgeMap) {
1804  OGDF_ASSERT(&(info.constGraph()) == nodeMap.registeredAt()->graphOf());
1805  OGDF_ASSERT(&(info.constGraph()) == edgeMap.registeredAt()->graphOf());
1806  m_regNodeArrays.reserveSpace(info.numberOfNodes(cc));
1807  m_regEdgeArrays.reserveSpace(info.numberOfEdges(cc));
1808  m_regAdjArrays.reserveSpace(info.numberOfEdges(cc));
1809  auto count = insert(info.nodes(cc).begin(), info.nodes(cc).end(), filter_any_edge, nodeMap,
1810  edgeMap);
1811  OGDF_ASSERT(count.first == info.numberOfNodes(cc));
1812  OGDF_ASSERT(count.second == info.numberOfEdges(cc));
1813  return count;
1814  }
1815 
1822  std::pair<int, int> insert(const Graph& G, NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap) {
1823  if (!nodeMap.registeredAt()) {
1824  nodeMap.init(G);
1825  }
1826  OGDF_ASSERT(nodeMap.registeredAt()->graphOf() == &G);
1827  if (!edgeMap.registeredAt()) {
1828  edgeMap.init(G);
1829  }
1830  OGDF_ASSERT(edgeMap.registeredAt()->graphOf() == &G);
1831  m_regNodeArrays.reserveSpace(G.numberOfNodes());
1832  m_regEdgeArrays.reserveSpace(G.numberOfEdges());
1833  m_regAdjArrays.reserveSpace(G.numberOfEdges());
1834  auto count = insert(G.nodes.begin(), G.nodes.end(), filter_any_edge, nodeMap, edgeMap);
1835  OGDF_ASSERT(count.first == G.numberOfNodes());
1836  OGDF_ASSERT(count.second == G.numberOfEdges());
1837  return count;
1838  }
1839 
1846  std::pair<int, int> insert(const Graph& G) {
1847  NodeArray<node> nodeMap(G, nullptr);
1848  EdgeArray<edge> edgeMap(G, nullptr);
1849  return insert(G, nodeMap, edgeMap);
1850  }
1851 
1852 private:
1853  template<OGDF_NODE_ITER NI, bool notifyObservers, bool copyIDs>
1854  void insertNodes(const NI& nodesBegin, const NI& nodesEnd, NodeArray<node, true>& nodeMap,
1855  int& newNodes, void* cbData);
1856 
1857 protected:
1873  virtual void* preInsert(bool copyEmbedding, bool copyIDs, bool notifyObservers, bool edgeFilter,
1874  NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap, int* newNodes, int* newEdges) {
1875  return nullptr;
1876  };
1877 
1885  virtual void nodeInserted(void* userData, node original, node copy) {};
1886 
1894  virtual void edgeInserted(void* userData, edge original, edge copy) {};
1895 
1903  virtual void postInsert(void* userData, int newNodes, int newEdges) {};
1905 
1906 public:
1909  const Graph* m_graph;
1910  int m_numCC;
1911 
1916 
1917  public:
1919  CCsInfo() : m_graph(nullptr), m_numCC(0) { }
1920 
1922  explicit CCsInfo(const Graph& G);
1923 
1925  const Graph& constGraph() const { return *m_graph; }
1926 
1928  int numberOfCCs() const { return m_numCC; }
1929 
1931  int numberOfNodes(int cc) const { return stopNode(cc) - startNode(cc); }
1932 
1934  int numberOfEdges(int cc) const { return stopEdge(cc) - startEdge(cc); }
1935 
1937  int startNode(int cc) const { return m_startNode[cc]; }
1938 
1940  int stopNode(int cc) const { return m_startNode[cc + 1]; }
1941 
1943  return {m_nodes.begin() + startNode(cc), m_nodes.begin() + stopNode(cc)};
1944  }
1945 
1947  return {m_edges.begin() + startEdge(cc), m_edges.begin() + stopEdge(cc)};
1948  }
1949 
1951  int startEdge(int cc) const { return m_startEdge[cc]; }
1952 
1954  int stopEdge(int cc) const { return m_startEdge[cc + 1]; }
1955 
1957  node v(int i) const { return m_nodes[i]; }
1958 
1960  edge e(int i) const { return m_edges[i]; }
1961  };
1962 
1963 private:
1971  inline node pureNewNode(int index) {
1972  if (index < 0) {
1973  index = m_nodeIdCount++;
1974  } else {
1975  m_nodeIdCount = max(m_nodeIdCount, index + 1);
1976  }
1977 
1978  // simple check against illegal index reuse
1979  OGDF_ASSERT(nodes.empty() || index != nodes.head()->index());
1980  OGDF_ASSERT(nodes.empty() || index != nodes.tail()->index());
1981 
1982 #ifdef OGDF_DEBUG
1983  node v = new NodeElement(this, index);
1984 #else
1985  node v = new NodeElement(index);
1986 #endif
1987  nodes.pushBack(v);
1988  return v;
1989  }
1990 
2002  edge pureNewEdge(node src, node tgt, int index) {
2003  OGDF_ASSERT(src != nullptr);
2004  OGDF_ASSERT(tgt != nullptr);
2005  OGDF_ASSERT(src->graphOf() == this);
2006  OGDF_ASSERT(tgt->graphOf() == this);
2007 
2008  if (index < 0) {
2009  index = m_edgeIdCount++;
2010  } else {
2011  m_edgeIdCount = max(m_edgeIdCount, index + 1);
2012  }
2013 
2014  // simple check against illegal index reuse
2015  OGDF_ASSERT(edges.empty() || index != edges.head()->index());
2016  OGDF_ASSERT(edges.empty() || index != edges.tail()->index());
2017 
2018  edge e = new EdgeElement(src, tgt, index);
2019  edges.pushBack(e);
2020 
2021  e->m_adjSrc = new AdjElement(e, index << 1);
2022  e->m_adjTgt = new AdjElement(e, (index << 1) | 1);
2023 
2024  e->m_adjSrc->m_twin = e->m_adjTgt;
2025  e->m_adjSrc->m_node = src;
2026  src->m_outdeg++;
2027 
2028  e->m_adjTgt->m_twin = e->m_adjSrc;
2029  e->m_adjTgt->m_node = tgt;
2030  tgt->m_indeg++;
2031 
2032  return e;
2033  }
2034 
2035  static inline void insertAdjEntry(adjEntry oldAdj, adjEntry newAdj, Direction dir) {
2036  if (dir == Direction::after) {
2037  oldAdj->theNode()->adjEntries.insertAfter(newAdj, oldAdj);
2038  } else {
2039  oldAdj->theNode()->adjEntries.insertBefore(newAdj, oldAdj);
2040  }
2041  }
2042 
2043  static inline void insertAdjEntry(node n, adjEntry newAdj, Direction dir) {
2044  if (dir == Direction::after || n->adjEntries.empty()) {
2045  n->adjEntries.pushBack(newAdj);
2046  } else {
2047  n->adjEntries.insertBefore(newAdj, n->adjEntries.head());
2048  }
2049  }
2050 
2052  void moveAdj(adjEntry adj, node w);
2053 };
2054 
2055 OGDF_EXPORT std::ostream& operator<<(std::ostream& os, const Graph::EdgeType& et);
2056 
2059 public:
2061  int getBucket(const edge& e) override { return e->source()->index(); }
2062 };
2063 
2066 public:
2068  int getBucket(const edge& e) override { return e->target()->index(); }
2069 };
2070 
2071 namespace internal {
2072 
2073 template<typename CONTAINER>
2074 inline void getAllNodes(const Graph& G, CONTAINER& nodes) {
2075  nodes.clear();
2076  for (node v : G.nodes) {
2077  nodes.pushBack(v);
2078  }
2079 }
2080 
2081 template<>
2082 inline void getAllNodes(const Graph& G, Array<node>& nodes) {
2083  nodes.init(G.numberOfNodes());
2084  int i = 0;
2085  for (node v : G.nodes) {
2086  nodes[i++] = v;
2087  }
2088 }
2089 
2090 template<typename CONTAINER>
2091 inline void getAllEdges(const Graph& G, CONTAINER& edges) {
2092  edges.clear();
2093  for (edge v : G.edges) {
2094  edges.pushBack(v);
2095  }
2096 }
2097 
2098 template<>
2099 inline void getAllEdges(const Graph& G, Array<edge>& edges) {
2100  edges.init(G.numberOfEdges());
2101  int i = 0;
2102  for (edge v : G.edges) {
2103  edges[i++] = v;
2104  }
2105 }
2106 
2107 }
2108 
2109 struct NodePair {
2110  node source = nullptr;
2111  node target = nullptr;
2112  NodePair() = default;
2113 
2114  NodePair(node src, node tgt) : source(src), target(tgt) { }
2115 };
2116 
2117 inline std::ostream& operator<<(std::ostream& os, const NodePair& np) {
2118  os << "(" << np.source << "," << np.target << ")";
2119  return os;
2120 }
2121 
2122 }
2123 
ogdf::internal::EdgeArrayBase1::operator()
Value & operator()(adjEntry adj)
Returns a reference to the element associated with the edge corresponding to adj.
Definition: Graph_d.h:707
OGDF_COPY_CONSTR
#define OGDF_COPY_CONSTR(cls)
Declares the copy constructor for class cls.
Definition: copy_move.h:57
ogdf::RegistryBase
Abstract base class for registries.
Definition: RegisteredArray.h:104
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::RegisteredArray
Dynamic arrays indexed with arbitrary keys.
Definition: RegisteredArray.h:817
OGDF_DECL_REG_ARRAY
#define OGDF_DECL_REG_ARRAY(NAME)
Definition: RegisteredArray.h:969
ogdf::internal::GraphList< GraphObject >::size
int size() const
Returns the size of the list.
Definition: GraphList.h:89
ogdf::Graph::m_hiddenEdgeSets
List< HiddenEdgeSet * > m_hiddenEdgeSets
The list of hidden edges.
Definition: Graph_d.h:884
ogdf::Direction
Direction
Definition: basic.h:150
ogdf::Graph::empty
bool empty() const
Returns true iff the graph is empty, i.e., contains no nodes.
Definition: Graph_d.h:979
ogdf::Graph::CCsInfo::numberOfEdges
int numberOfEdges(int cc) const
Returns the number of edges in connected component cc.
Definition: Graph_d.h:1934
ogdf::Graph::adjEntryRegistry
internal::GraphAdjRegistry & adjEntryRegistry()
Returns a reference to the registry of adjEntry arrays associated with this graph.
Definition: Graph_d.h:1641
ogdf::Graph::sort
void sort(node v, const ADJ_ENTRY_LIST &newOrder)
Sorts the adjacency list of node v according to newOrder.
Definition: Graph_d.h:1482
ogdf::Graph::insert
std::pair< int, int > insert(const Graph &G)
Inserts a copy of a given Graph G into this graph.
Definition: Graph_d.h:1846
ogdf::Graph::pureNewNode
node pureNewNode(int index)
Creates a new node object with id index and adds it to the list of nodes.
Definition: Graph_d.h:1971
ogdf::GraphObserver::getGraph
const Graph * getGraph() const
Definition: Graph_d.h:803
ogdf::Graph::CCsInfo
Info structure for maintaining connected components.
Definition: Graph_d.h:1908
ogdf::AdjElement::pred
adjEntry pred() const
Returns the predecessor in the adjacency list.
Definition: Graph_d.h:221
ogdf::Graph::pureNewEdge
edge pureNewEdge(node src, node tgt, int index)
Creates a new edge object with id index and corresponding AdjElements and adds it to the list of edge...
Definition: Graph_d.h:2002
ogdf::internal::GraphRegisteredArray::graphOf
Graph * graphOf() const
Returns a pointer to the associated graph.
Definition: Graph_d.h:665
ogdf::GraphAdjIterator::m_pGraph
Graph * m_pGraph
Definition: Graph_d.h:524
ogdf::internal::GraphList< GraphObject >::tail
GraphObject * tail() const
Returns the last element in the list.
Definition: GraphList.h:327
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
ogdf::Graph::insertAdjEntry
static void insertAdjEntry(node n, adjEntry newAdj, Direction dir)
Definition: Graph_d.h:2043
ogdf::GraphAdjIterator::operator!=
bool operator!=(const GraphAdjIterator &iter) const
Inequality operator.
Definition: Graph_d.h:558
ogdf::internal::GraphIteratorBase
Definition: graph_iterators.h:45
ogdf::Graph::CCsInfo::nodes
internal::SimpleRange< Array< node >::const_iterator > nodes(int cc) const
Definition: Graph_d.h:1942
ogdf::Graph::edgeRegistry
internal::GraphEdgeRegistry & edgeRegistry()
Returns a reference to the registry of edge arrays associated with this graph.
Definition: Graph_d.h:1633
ogdf::Graph::CCsInfo::e
edge e(int i) const
Returns the edge with index i.
Definition: Graph_d.h:1960
ogdf::AdjElement::theNode
node theNode() const
Returns the node whose adjacency list contains this element.
Definition: Graph_d.h:166
ogdf::NodeElement::m_indeg
int m_indeg
The indegree of the node.
Definition: Graph_d.h:245
ogdf::Graph::maxEdgeIndex
int maxEdgeIndex() const
Returns the largest used edge index.
Definition: Graph_d.h:991
ogdf::EdgeElement::isParallelUndirected
bool isParallelUndirected(edge e) const
Returns true iff edge e is parallel to this (undirected) edge (or if it is the same edge)
Definition: Graph_d.h:428
ogdf::Graph::CCsInfo::stopEdge
int stopEdge(int cc) const
Returns the index of (one past) the last edge in connected component cc.
Definition: Graph_d.h:1954
copy_move.h
Utility macros for declaring copy and move constructors and assignment operations.
ogdf::internal::getAllEdges
void getAllEdges(const Graph &G, CONTAINER &edges)
Definition: Graph_d.h:2091
ogdf::Graph::HiddenEdgeSet::HiddenEdgeSet
HiddenEdgeSet(Graph &graph)
Creates a new set of hidden edges.
Definition: Graph_d.h:1234
ogdf::internal::GraphRegistry::GraphRegistry
GraphRegistry(Graph *graph, int *nextKeyIndex)
Constructor.
Definition: Graph_d.h:606
ogdf::AdjElement::counterClockwiseFaceSucc
adjEntry counterClockwiseFaceSucc() const
Returns the counter-clockwise successor in face.
Definition: Graph_d.h:205
ogdf::Graph::EdgeType
EdgeType
The type of edges (only used in derived classes).
Definition: Graph_d.h:909
ogdf::RegisteredArray::RA
typename std::conditional< WithDefault, internal::RegisteredArrayWithDefault< Registry, Value >, internal::RegisteredArrayWithoutDefault< Registry, Value > >::type RA
Definition: RegisteredArray.h:822
ogdf::Graph::swapAdjEdges
void swapAdjEdges(adjEntry adj1, adjEntry adj2)
Exchanges two entries in an adjacency list.
Definition: Graph_d.h:1579
ogdf::begin
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
ogdf::Graph::CCsInfo::m_startNode
Array< int > m_startNode
start node of each connected component in m_nodes.
Definition: Graph_d.h:1914
ogdf::NodeElement::lastAdj
adjEntry lastAdj() const
Returns the last entry in the adjacency list.
Definition: Graph_d.h:289
ogdf::Graph::HiddenEdgeSet
Functionality for temporarily hiding edges in constant time.
Definition: Graph_d.h:1224
ogdf::NodeElement::index
int index() const
Returns the (unique) node index.
Definition: Graph_d.h:274
ogdf::Graph::CCsInfo::constGraph
const Graph & constGraph() const
Returns the associated graph.
Definition: Graph_d.h:1925
ogdf::internal::getAllNodes
void getAllNodes(const Graph &G, CONTAINER &nodes)
Definition: Graph_d.h:2074
ogdf::internal::GraphElement::m_next
GraphElement * m_next
The successor in the list.
Definition: GraphList.h:65
ogdf::AdjElement::cyclicPred
adjEntry cyclicPred() const
Returns the cyclic predecessor in the adjacency list.
Definition: Graph_d.h:358
ogdf::NodePair
Definition: Graph_d.h:2109
ogdf::internal::GraphElement
The base class for objects used by (hyper)graphs.
Definition: GraphList.h:60
ogdf::EdgeArray
internal::EdgeArrayBase2< Value, WithDefault > EdgeArray
RegisteredArray for labeling the edges in a Graph with an arbitrary Value.
Definition: Graph_d.h:745
ogdf::Graph::adjEntryRegistry
const internal::GraphAdjRegistry & adjEntryRegistry() const
Returns a const reference to the registry of adjEntry arrays associated with this graph.
Definition: Graph_d.h:1644
ogdf::Graph::moveAdjBefore
void moveAdjBefore(adjEntry adjMove, adjEntry adjBefore)
Moves adjacency entry adjMove before adjBefore.
Definition: Graph_d.h:1561
ogdf::Graph::allNodes
void allNodes(CONTAINER &nodeContainer) const
Returns a container with all nodes of the graph.
Definition: Graph_d.h:1036
Observer.h
Simple, safe base classes for C++ observables and observers.
ogdf::EdgeElement::isParallelDirected
bool isParallelDirected(edge e) const
Returns true iff edge e is parallel to this (directed) edge (or if it is the same edge)
Definition: Graph_d.h:425
ogdf::operator==
bool operator==(const Tuple2< E1, E2 > &t1, const Tuple2< E1, E2 > &t2)
Equality operator for 2-tuples.
Definition: tuples.h:77
ogdf::sync_plan::split
std::pair< node, node > split(Graph &G, sync_plan::PipeBij &bij, const EdgeArray< edge > *new_edges=nullptr, const EdgeArray< bool > *reverse_edges=nullptr, node src=nullptr, node tgt=nullptr)
ogdf::Graph::moveAdjAfter
void moveAdjAfter(adjEntry adjMove, adjEntry adjAfter)
Moves adjacency entry adjMove after adjAfter.
Definition: Graph_d.h:1546
ogdf::Graph::m_regEdgeArrays
internal::GraphEdgeRegistry m_regEdgeArrays
The registered edge arrays.
Definition: Graph_d.h:881
ogdf::GraphAdjIterator::operator--
GraphAdjIterator operator--(int)
Decrement operator (postfix).
Definition: Graph_d.h:580
ogdf::EdgeElement::isInvertedDirected
bool isInvertedDirected(edge e) const
Returns true iff edge e is an inverted edge to this (directed) edge.
Definition: Graph_d.h:422
ogdf::internal::GraphRegistry::graphOf
Graph * graphOf() const
Returns a pointer to the associated graph.
Definition: Graph_d.h:634
ogdf::Graph::nodeRegistry
const internal::GraphNodeRegistry & nodeRegistry() const
Returns a const reference to the registry of node arrays associated with this graph.
Definition: Graph_d.h:1628
ogdf::EdgeElement::index
int index() const
Returns the index of the edge.
Definition: Graph_d.h:395
ogdf::NodePair::source
node source
Definition: Graph_d.h:2110
ogdf::GraphAdjIterator
Iterator for AdjEntries of a graph.
Definition: Graph_d.h:523
ogdf::Graph::CCsInfo::m_startEdge
Array< int > m_startEdge
start edge of each connected component in m_edges.
Definition: Graph_d.h:1915
ogdf::filter_any_edge
bool filter_any_edge(edge e)
std::function<bool(edge)> that returns true for any edge e
ogdf::NodeElement::inEdges
void inEdges(EDGELIST &edgeList) const
Returns a list with all incoming edges of this node.
Definition: Graph_d.h:501
ogdf::Graph::insert
std::pair< int, int > insert(const Graph &G, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
Inserts a copy of a given Graph G into this graph.
Definition: Graph_d.h:1822
OGDF_CHECK_CONCEPT
#define OGDF_CHECK_CONCEPT(...)
Definition: Graph_d.h:134
ogdf::Graph::sort
void sort(node v, IT begin, IT end)
Sorts the adjacency list of node v according to the range denoted by two iterators.
Definition: Graph_d.h:1498
OGDF_AUGMENT_STATICCOMPARER
#define OGDF_AUGMENT_STATICCOMPARER(type)
Add this macro to your class to turn it into a full static comparer.
Definition: comparer.h:229
ogdf::BucketSourceIndex::getBucket
int getBucket(const edge &e) override
Returns source index of e.
Definition: Graph_d.h:2061
ogdf::BucketFunc
Abstract base class for bucket functions.
Definition: basic.h:257
ogdf::NodeElement::pred
node pred() const
Returns the predecessor in the list of all nodes.
Definition: Graph_d.h:295
ogdf::EdgeElement::m_src
node m_src
The source node of the edge.
Definition: Graph_d.h:367
OGDF_EDGE_ITER
#define OGDF_EDGE_ITER
Definition: Graph_d.h:130
OGDF_NO_MOVE
#define OGDF_NO_MOVE(cls)
Explicitly disables (deletes) move construction and assignment for class cls.
Definition: copy_move.h:42
ogdf::internal::EdgeArrayBase2< edge, WithDefault >::mapEndpoint
adjEntry mapEndpoint(adjEntry adj) const
Map a source/target adjEntry to the source/target adjEntry of the corresponding edges.
Definition: Graph_d.h:729
ogdf::Graph::CCsInfo::m_numCC
int m_numCC
the number of connected components.
Definition: Graph_d.h:1910
ogdf::internal::GraphObjectContainer
Public read-only interface for lists of graph objects.
Definition: GraphList.h:410
ogdf::AdjElement::graphOf
const Graph * graphOf() const
Definition: Graph_d.h:476
ogdf::GraphAdjIterator::operator++
GraphAdjIterator operator++(int)
Increment operator (postfix).
Definition: Graph_d.h:567
ogdf::Graph::postInsert
virtual void postInsert(void *userData, int newNodes, int newEdges)
Callback notifying subclasses that an insert() call has finished.
Definition: Graph_d.h:1903
ogdf::Array::init
void init()
Reinitializes the array to an array with empty index set.
Definition: Array.h:372
ogdf::Graph::allEdges
void allEdges(CONTAINER &edgeContainer) const
Returns a container with all edges of the graph.
Definition: Graph_d.h:1046
ogdf::AdjElement::twin
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
Definition: Graph_d.h:172
ogdf::NodeArray
internal::GraphRegisteredArray< NodeElement, Value, WithDefault > NodeArray
RegisteredArray for labeling the nodes in a Graph with an arbitrary Value.
Definition: Graph_d.h:740
OGDF_NEW_DELETE
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition: memory.h:85
ogdf::internal::GraphList::move
void move(T *pX, GraphList< T > &L, T *pY, Direction dir)
Moves element pX to list L and inserts it before or after pY.
Definition: GraphList.h:339
ogdf::Graph::HiddenEdgeSet::m_it
ListIterator< HiddenEdgeSet * > m_it
Definition: Graph_d.h:1286
ogdf::GraphAdjIterator::end
GraphAdjIterator end()
Returns an iterator to the one-past-last adjEntry in the associated graph.
Definition: Graph_d.h:538
ogdf::Graph::edgeRegistry
const internal::GraphEdgeRegistry & edgeRegistry() const
Returns a const reference to the registry of edge arrays associated with this graph.
Definition: Graph_d.h:1636
ogdf::AdjElement::m_edge
edge m_edge
The associated edge.
Definition: Graph_d.h:148
ogdf::EdgeElement::EdgeElement
EdgeElement(node src, node tgt, int id)
Constructs an edge element (src,tgt).
Definition: Graph_d.h:390
OGDF_NODE_FILTER
#define OGDF_NODE_FILTER
Definition: Graph_d.h:127
ogdf::Graph::CCsInfo::edges
internal::SimpleRange< Array< edge >::const_iterator > edges(int cc) const
Definition: Graph_d.h:1946
ogdf::Graph::nodeInserted
virtual void nodeInserted(void *userData, node original, node copy)
Callback notifying subclasses that insert() copied a node.
Definition: Graph_d.h:1885
ogdf::NodeElement::m_outdeg
int m_outdeg
The outdegree of the node.
Definition: Graph_d.h:246
ogdf::Graph::insert
std::pair< int, int > insert(const CCsInfo &info, int cc, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
Inserts a copy of a given connected component cc into this graph.
Definition: Graph_d.h:1802
ogdf::adjEntry
AdjElement * adjEntry
The type of adjacency entries.
Definition: Graph_d.h:78
ogdf::Graph::CCsInfo::v
node v(int i) const
Returns the node with index i.
Definition: Graph_d.h:1957
ogdf::filter_any_node
bool filter_any_node(node n)
std::function<bool(node)> that returns true for any node n
ogdf::AdjElement::faceCyclePred
adjEntry faceCyclePred() const
Returns the cyclic predecessor in face.
Definition: Graph_d.h:215
ogdf::internal::GraphRegistry::keyToIndex
static int keyToIndex(Key *key)
Definition: Graph_d.h:609
ogdf::Graph::CCsInfo::CCsInfo
CCsInfo()
Creates a info structure associated with no graph.
Definition: Graph_d.h:1919
ogdf::Graph::insertAdjEntry
static void insertAdjEntry(adjEntry oldAdj, adjEntry newAdj, Direction dir)
Definition: Graph_d.h:2035
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::NodeElement::m_pGraph
const Graph * m_pGraph
The graph containg this node (debug only).
Definition: Graph_d.h:251
InducedSubgraph.h
Implementation of the ogdf::Graph::insert(...) template methods.
ogdf::AdjElement::isSource
bool isSource() const
Returns true iff this is the source adjacency entry of the corresponding edge.
Definition: Graph_d.h:479
ogdf::Graph::newEdge
edge newEdge(adjEntry adjSrc, node w, int index=-1)
Creates a new edge at predefined positions in the adjacency lists.
Definition: Graph_d.h:1121
ogdf::NodeElement::compare
static int compare(const NodeElement &x, const NodeElement &y)
Standard Comparer.
Definition: Graph_d.h:348
ogdf::Graph::nodeRegistry
internal::GraphNodeRegistry & nodeRegistry()
Returns a reference to the registry of node arrays associated with this graph.
Definition: Graph_d.h:1625
ogdf::AdjElement::clockwiseFacePred
adjEntry clockwiseFacePred() const
Returns the clockwise predecessor in face. Use faceCycleSucc instead!
Definition: Graph_d.h:202
ogdf::edge
EdgeElement * edge
The type of edges.
Definition: Graph_d.h:74
Minisat::Internal::sort
void sort(T *array, int size, LessThan lt)
Definition: Sort.h:57
ogdf::internal::GraphRegistry::m_pGraph
Graph * m_pGraph
Definition: Graph_d.h:599
ogdf::AdjElement::theEdge
edge theEdge() const
Returns the edge associated with this adjacency entry.
Definition: Graph_d.h:160
ogdf::Observable
Base class for an observable object that can be tracked by multiple Observer objects.
Definition: Observer.h:104
OGDF_NODE_ITER
#define OGDF_NODE_ITER
Definition: Graph_d.h:129
ogdf::EdgeElement::m_adjTgt
AdjElement * m_adjTgt
Corresponding adjacency entry at target node.
Definition: Graph_d.h:370
ogdf::Direction::after
@ after
ogdf::GraphAdjIterator::operator--
GraphAdjIterator & operator--()
Decrement operator (prefix).
Definition: Graph_d.h:574
ogdf::Graph::nodes
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
Definition: Graph_d.h:932
Minisat::Internal::copy
static void copy(const T &from, T &to)
Definition: Alg.h:61
ogdf::EdgeElement::isSelfLoop
bool isSelfLoop() const
Returns true iff the edge is a self-loop (source node = target node).
Definition: Graph_d.h:419
ogdf::Graph::reverseAdjEdges
void reverseAdjEdges(node v)
Reverses the adjacency list of v.
Definition: Graph_d.h:1520
ogdf::Graph::numberOfEdges
int numberOfEdges() const
Returns the number of edges in the graph.
Definition: Graph_d.h:985
ogdf::NodeElement::outdeg
int outdeg() const
Returns the outdegree of the node.
Definition: Graph_d.h:280
ogdf::BucketTargetIndex::getBucket
int getBucket(const edge &e) override
Returns target index of e.
Definition: Graph_d.h:2068
ogdf::NodeElement::degree
int degree() const
Returns the degree of the node (indegree + outdegree).
Definition: Graph_d.h:283
ogdf::AdjElement::clockwiseFaceSucc
adjEntry clockwiseFaceSucc() const
Returns the clockwise successor in face. Use faceCycleSucc instead!
Definition: Graph_d.h:199
ogdf::Graph::m_edgeIdCount
int m_edgeIdCount
The Index that will be assigned to the next created edge.
Definition: Graph_d.h:878
OGDF_MALLOC_NEW_DELETE
#define OGDF_MALLOC_NEW_DELETE
Makes the class use malloc for memory allocation.
Definition: memory.h:92
ogdf::internal::adjToNode
node adjToNode(adjEntry adj)
Definition: Graph_d.h:812
ogdf::Graph::CCsInfo::stopNode
int stopNode(int cc) const
Returns the index of (one past) the last node in connected component cc.
Definition: Graph_d.h:1940
ogdf::Graph::numberOfNodes
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:982
ogdf::AdjElement::AdjElement
AdjElement(node v)
Constructs an adjacency element for a given node.
Definition: Graph_d.h:153
ogdf::gml::Key::Graph
@ Graph
ogdf::AdjEntryArray
internal::GraphRegisteredArray< AdjElement, Value, WithDefault, internal::GraphAdjRegistry > AdjEntryArray
RegisteredArray for labeling the adjEntries in a Graph with an arbitrary Value.
Definition: Graph_d.h:751
backward::details::move
const T & move(const T &v)
Definition: backward.hpp:243
ogdf::Array< node >
GraphList.h
Decralation of GraphElement and GraphList classes.
ogdf::AdjElement::succ
adjEntry succ() const
Returns the successor in the adjacency list.
Definition: Graph_d.h:218
ogdf::NodeElement::adjEntries
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
Definition: Graph_d.h:271
OGDF_EDGE_FILTER
#define OGDF_EDGE_FILTER
Definition: Graph_d.h:128
ogdf::calculateTableSize
int calculateTableSize(int actualCount)
The default growth function for registered arrays.
Definition: RegisteredArray.h:67
ogdf::internal::EA
EdgeArray< T, true > EA
Definition: GraphMultiArray.h:42
ogdf::internal::GraphList< GraphObject >::pushBack
void pushBack(GraphObject *pX)
Adds element pX at the end of the list.
Definition: GraphList.h:330
ogdf::NodeElement::indeg
int indeg() const
Returns the indegree of the node.
Definition: Graph_d.h:277
RegisteredArray.h
Declaration and implementation of RegisteredArray class.
ogdf::Graph::newEdge
edge newEdge(S src, Direction dirSrc, T tgt, Direction dirTgt, int index=-1)
Creates a new edge at predefined positions in the adjacency lists.
Definition: Graph_d.h:1168
ogdf::BucketSourceIndex
Bucket function using the index of an edge's source node as bucket.
Definition: Graph_d.h:2058
ogdf::EdgeSet
Edge sets.
Definition: Graph_d.h:755
ogdf::Graph::HiddenEdgeSet::m_edges
internal::GraphList< EdgeElement > m_edges
Definition: Graph_d.h:1285
ogdf::NodePair::target
node target
Definition: Graph_d.h:2111
ogdf::Graph::firstNode
node firstNode() const
Returns the first node in the list of all nodes.
Definition: Graph_d.h:997
ogdf::Graph::HiddenEdgeSet::~HiddenEdgeSet
~HiddenEdgeSet()
Restores all hidden edges.
Definition: Graph_d.h:1241
OGDF_NO_COPY
#define OGDF_NO_COPY(cls)
Explicitly disables (deletes) copy construction and assignment for class cls.
Definition: copy_move.h:37
ogdf::AdjElement::isBetween
bool isBetween(adjEntry adjBefore, adjEntry adjAfter) const
Returns whether this adjacency entry lies between adjBefore and adjAfter in clockwise rotation.
Definition: Graph_d.h:481
ogdf::internal::GraphRegistry::isKeyAssociated
bool isKeyAssociated(Key *key) const
Definition: Graph_d.h:611
ogdf::Graph::maxNodeIndex
int maxNodeIndex() const
Returns the largest used node index.
Definition: Graph_d.h:988
ogdf::EdgeElement::pred
edge pred() const
Returns the predecessor in the list of all edges.
Definition: Graph_d.h:436
ogdf::internal::GraphRegistry::m_nextKeyIndex
int * m_nextKeyIndex
Definition: Graph_d.h:600
ogdf::operator<<
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
Definition: Array.h:983
ogdf::BucketTargetIndex
Bucket function using the index of an edge's target node as bucket.
Definition: Graph_d.h:2065
config_autogen.h
ogdf::Array::begin
iterator begin()
Returns an iterator to the first element.
Definition: Array.h:329
ogdf::EdgeElement::source
node source() const
Returns the source node of the edge.
Definition: Graph_d.h:398
ogdf::node
NodeElement * node
The type of nodes.
Definition: Graph_d.h:70
ogdf::GraphObserver
Abstract Base class for graph observers.
Definition: Graph_d.h:777
ogdf::GraphObserver::GraphObserver
GraphObserver(const Graph *G)
Constructs instance of GraphObserver class.
Definition: Graph_d.h:786
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::RegistryBase::keyAdded
void keyAdded(Key key)
Records the addition of a new key and resizes all registered arrays if necessary.
Definition: RegisteredArray.h:171
ogdf::EdgeElement::adjSource
adjEntry adjSource() const
Returns the corresponding adjacancy entry at source node.
Definition: Graph_d.h:407
ogdf::internal::GraphListBase
Base class for GraphElement lists.
Definition: GraphList.h:72
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::internal::EdgeArrayBase1::operator[]
const Value & operator[](adjEntry adj) const
Returns a const reference to the element associated with the edge corresponding to adj.
Definition: Graph_d.h:686
ogdf::NodePair::NodePair
NodePair()=default
ogdf::internal::GraphList
Lists of graph objects (like nodes, edges, etc.).
Definition: GraphList.h:301
ogdf::Graph::preInsert
virtual void * preInsert(bool copyEmbedding, bool copyIDs, bool notifyObservers, bool edgeFilter, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap, int *newNodes, int *newEdges)
Callback notifying subclasses that some graph is about to be insert() -ed.
Definition: Graph_d.h:1873
ogdf::Graph::CCsInfo::numberOfNodes
int numberOfNodes(int cc) const
Returns the number of nodes in connected component cc.
Definition: Graph_d.h:1931
ogdf::Graph::lastNode
node lastNode() const
Returns the last node in the list of all nodes.
Definition: Graph_d.h:1000
ogdf::AdjElement::m_id
int m_id
The (unique) index of the adjacency entry.
Definition: Graph_d.h:150
ogdf::Graph::NodeType
NodeType
The type of nodes.
Definition: Graph_d.h:912
OGDF_COPY_OP
#define OGDF_COPY_OP(cls)
Declares the copy assignment operation for class cls. Don't forget to return *this;.
Definition: copy_move.h:59
ogdf::Graph::lastEdge
edge lastEdge() const
Returns the last edge in the list of all edges.
Definition: Graph_d.h:1006
ogdf::AdjElement::twinNode
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Definition: Graph_d.h:175
graph_iterators.h
Decralation of graph iterators.
ogdf::EdgeElement::getAdj
adjEntry getAdj(node v) const
Returns an adjacency entry of this edge at node v. If this is a self-loop the source adjacency entry ...
Definition: Graph_d.h:458
ogdf::AdjElement::cyclicSucc
adjEntry cyclicSucc() const
Returns the cyclic successor in the adjacency list.
Definition: Graph_d.h:354
ogdf::AdjElement::m_twin
AdjElement * m_twin
The corresponding adjacency entry (same edge)
Definition: Graph_d.h:147
ogdf::internal::GraphList< GraphObject >::empty
bool empty() const
Returns true iff the list is empty.
Definition: GraphList.h:92
ogdf::Graph::m_nodeIdCount
int m_nodeIdCount
The Index that will be assigned to the next created node.
Definition: Graph_d.h:877
ogdf::EdgeElement::adjTarget
adjEntry adjTarget() const
Returns the corresponding adjacancy entry at target node.
Definition: Graph_d.h:410
ogdf::GraphAdjIterator::m_entry
adjEntry m_entry
Definition: Graph_d.h:525
ogdf::EdgeElement::m_adjSrc
AdjElement * m_adjSrc
Corresponding adjacency entry at source node.
Definition: Graph_d.h:369
ogdf::Graph::representsCombEmbedding
bool representsCombEmbedding() const
Returns true iff the graph represents a combinatorial embedding.
Definition: Graph_d.h:1609
ogdf::NodeElement::allAdjEntries
void allAdjEntries(ADJLIST &adjList) const
Returns a list with all adjacency entries of this node.
Definition: Graph_d.h:303
ogdf::NodePair::NodePair
NodePair(node src, node tgt)
Definition: Graph_d.h:2114
ogdf::NodeElement::adjEdges
void adjEdges(EDGELIST &edgeList) const
Returns a list with all edges incident to this node.
Definition: Graph_d.h:319
ogdf::Graph::newEdge
edge newEdge(adjEntry adjSrc, adjEntry adjTgt, Direction dir=Direction::after, int index=-1)
Creates a new edge at predefined positions in the adjacency lists.
Definition: Graph_d.h:1143
ogdf::internal::GraphList< GraphObject >::head
GraphObject * head() const
Returns the first element in the list.
Definition: GraphList.h:324
ogdf::Observer
Base class for an observer for a single Observable object.
Definition: Observer.h:53
ogdf::Graph::firstEdge
edge firstEdge() const
Returns the first edge in the list of all edges.
Definition: Graph_d.h:1003
ogdf::Graph::edges
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Definition: Graph_d.h:935
ogdf::internal::GraphElement::m_prev
GraphElement * m_prev
The predecessor in the list.
Definition: GraphList.h:66
ogdf::GraphAdjIterator::operator==
bool operator==(const GraphAdjIterator &iter) const
Equality operator.
Definition: Graph_d.h:553
ogdf::AdjElement::compare
static int compare(const AdjElement &x, const AdjElement &y)
Standard Comparer.
Definition: Graph_d.h:233
OGDF_NODE_LIST
#define OGDF_NODE_LIST
Definition: Graph_d.h:131
basic.h
Basic declarations, included by all source files.
ogdf::GraphAdjIterator::operator->
AdjElement & operator->() const
Returns a reference to the associated adjElement.
Definition: Graph_d.h:550
ogdf::end
HypergraphRegistry< HypernodeElement >::iterator end(const HypergraphRegistry< HypernodeElement > &self)
ogdf::internal::SimpleRange
Definition: graph_iterators.h:209
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::Graph::HiddenEdgeSet::m_graph
Graph * m_graph
Definition: Graph_d.h:1287
ogdf::internal::EdgeArrayBase1
RegisteredArray for edges of a graph.
Definition: Graph_d.h:676
ogdf::EdgeElement::compare
static int compare(const EdgeElement &x, const EdgeElement &y)
Standard Comparer.
Definition: Graph_d.h:464
ogdf::Graph::newNode
node newNode(int index=-1)
Creates a new node and returns it.
Definition: Graph_d.h:1064
ogdf::NodeElement::firstAdj
adjEntry firstAdj() const
Returns the first entry in the adjaceny list.
Definition: Graph_d.h:286
ogdf::NodeElement::succ
node succ() const
Returns the successor in the list of all nodes.
Definition: Graph_d.h:292
ogdf::AdjElement::faceCycleSucc
adjEntry faceCycleSucc() const
Returns the cyclic successor in face.
Definition: Graph_d.h:212
Array.h
Declaration and implementation of Array class and Array algorithms.
ogdf::EdgeElement::m_tgt
node m_tgt
The target node of the edge.
Definition: Graph_d.h:368
ogdf::Graph::m_regNodeArrays
internal::GraphNodeRegistry m_regNodeArrays
The registered node arrays.
Definition: Graph_d.h:880
ogdf::EdgeElement::opposite
node opposite(node v) const
Returns the adjacent node different from v.
Definition: Graph_d.h:413
ogdf::Graph::CCsInfo::startNode
int startNode(int cc) const
Returns the index of the first node in connected component cc.
Definition: Graph_d.h:1937
OGDF_EDGE_LIST
#define OGDF_EDGE_LIST
Definition: Graph_d.h:132
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ogdf::internal::EdgeArrayBase1::operator[]
Value & operator[](adjEntry adj)
Returns a reference to the element associated with the edge corresponding to adj.
Definition: Graph_d.h:693
ogdf::Graph::moveAdj
void moveAdj(adjEntry adjMove, Direction dir, adjEntry adjPos)
Moves adjacency entry adjMove before or after adjPos.
Definition: Graph_d.h:1530
ogdf::Graph::CCsInfo::m_graph
const Graph * m_graph
points to the associated graph.
Definition: Graph_d.h:1909
List.h
Declaration of doubly linked lists and iterators.
ogdf::EdgeElement::succ
edge succ() const
Returns the successor in the list of all edges.
Definition: Graph_d.h:433
ogdf::NodeElement::graphOf
const Graph * graphOf() const
Returns the graph containing this node (debug only).
Definition: Graph_d.h:344
ogdf::Graph::CCsInfo::m_nodes
Array< node > m_nodes
array of all nodes.
Definition: Graph_d.h:1912
ogdf::Graph::CCsInfo::m_edges
Array< edge > m_edges
array of all edges.
Definition: Graph_d.h:1913
ogdf::AdjElement::AdjElement
AdjElement(edge e, int id)
Constructs an adjacency entry for a given edge and index.
Definition: Graph_d.h:156
ogdf::RegisteredArray< GraphRegistry< Key >, Value, WithDefault, Graph >::init
void init(const Graph *base=nullptr)
Reinitializes the array. Associates the array with the matching registry of base.
Definition: RegisteredArray.h:858
ogdf::EdgeElement::isIncident
bool isIncident(node v) const
Returns true iff v is incident to the edge.
Definition: Graph_d.h:444
ogdf::AdjElement::m_node
node m_node
The node whose adjacency list contains this entry.
Definition: Graph_d.h:149
ogdf::Graph::newEdge
edge newEdge(node v, adjEntry adjTgt, int index=-1)
Creates a new edge at predefined positions in the adjacency lists.
Definition: Graph_d.h:1102
ogdf::Graph::maxAdjEntryIndex
int maxAdjEntryIndex() const
Returns the largest used adjEntry index.
Definition: Graph_d.h:994
ogdf::AdjElement::counterClockwiseFacePred
adjEntry counterClockwiseFacePred() const
Returns the counter-clockwise predecessor in face.
Definition: Graph_d.h:208
ogdf::Graph::insert
std::pair< int, int > insert(const NL &nodeList, const EL &edgeList, NodeArray< node > &nodeMap, EdgeArray< edge > &edgeMap)
Inserts a copy of a given subgraph into this graph.
Definition: Graph_d.h:1783
ogdf::EdgeElement::EdgeElement
EdgeElement(node src, node tgt, AdjElement *adjSrc, AdjElement *adjTgt, int id)
Constructs an edge element (src,tgt).
Definition: Graph_d.h:381
ogdf::ListIteratorBase
Encapsulates a pointer to a list element.
Definition: List.h:51
ogdf::AdjElement::index
int index() const
Returns the index of this adjacency element.
Definition: Graph_d.h:178
ogdf::internal::GraphRegistry::maxKeyIndex
int maxKeyIndex() const
Definition: Graph_d.h:631
ogdf::NodeElement::outEdges
void outEdges(EDGELIST &edgeList) const
Returns a list with all outgoing edges of this node.
Definition: Graph_d.h:512
ogdf::internal::GraphRegistry::iterator
typename Iterable::iterator iterator
Definition: Graph_d.h:603
ogdf::RegistryBase< Key *, GraphRegistry< Key, GraphObjectContainer< Key >, 1 >, GraphObjectContainer< Key > ::iterator >::getArraySize
int getArraySize() const
Returns the current size of all registered arrays.
Definition: RegisteredArray.h:245
ogdf::Graph::edgeInserted
virtual void edgeInserted(void *userData, edge original, edge copy)
Callback notifying subclasses that insert() copied an edge.
Definition: Graph_d.h:1894
ogdf::internal::EdgeArrayBase1::operator()
const Value & operator()(adjEntry adj) const
Returns a const reference to the element associated with the edge corresponding to adj.
Definition: Graph_d.h:700
ogdf::EdgeElement::nodes
std::array< node, 2 > nodes() const
Returns a list of adjacent nodes. If this edge is a self-loop, both entries will be the same node.
Definition: Graph_d.h:404
ogdf::EdgeElement::target
node target() const
Returns the target node of the edge.
Definition: Graph_d.h:401
ogdf::Graph::CCsInfo::numberOfCCs
int numberOfCCs() const
Returns the number of connected components.
Definition: Graph_d.h:1928
ogdf::GraphAdjIterator::operator++
GraphAdjIterator & operator++()
Increment operator (prefix).
Definition: Graph_d.h:561
ogdf::NodeElement::m_id
int m_id
The (unique) index of the node.
Definition: Graph_d.h:247
ogdf::Graph::newEdge
edge newEdge(node v, node w, int index=-1)
Creates a new edge (v,w) and returns it.
Definition: Graph_d.h:1083
ogdf::EdgeElement::m_id
int m_id
Definition: Graph_d.h:371
ogdf::copyEmbedding
void copyEmbedding(const Graph &from, Graph &to, std::function< adjEntry(adjEntry)> adjMapFromTo)
ogdf::internal::GraphRegistry
Registry for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:597
comparer.h
Declarations for Comparer objects.
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::Graph::m_regAdjArrays
internal::GraphAdjRegistry m_regAdjArrays
The registered adjEntry arrays.
Definition: Graph_d.h:882
ogdf::EdgeElement::commonNode
node commonNode(edge e) const
Returns the common node of the edge and e. Returns nullptr if the two edges are not adjacent.
Definition: Graph_d.h:450
ogdf::GraphAdjIterator::operator*
adjEntry operator*() const
Returns the associated adjEntry.
Definition: Graph_d.h:547
memory.h
Declaration of memory manager for allocating small pieces of memory.
ogdf::EdgeElement::isAdjacent
bool isAdjacent(edge e) const
Returns true iff e is adjacent to the edge.
Definition: Graph_d.h:447
ogdf::internal::GraphRegistry::calculateArraySize
int calculateArraySize(int add) const
Definition: Graph_d.h:627
ogdf::Graph::CCsInfo::startEdge
int startEdge(int cc) const
Returns the index of the first edge in connected component cc.
Definition: Graph_d.h:1951
ogdf::Graph::collapse
void collapse(NODELIST &nodesToCollapse)
Collapses all nodes in the list nodesToCollapse to the first node in the list.
Definition: Graph_d.h:1452
ogdf::NodeElement::NodeElement
NodeElement(const Graph *pGraph, int id)
Constructs a node element with index id.
Definition: Graph_d.h:262
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:716
ogdf::RegistryBase::reserveSpace
void reserveSpace(int new_keys)
Resizes all arrays to make space of new_keys new keys.
Definition: RegisteredArray.h:206