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 AdjElement; // IWYU pragma: keep
62 class ClusterElement; // IWYU pragma: keep
63 class EdgeElement; // IWYU pragma: keep
64 class EdgeSet; // needed for Graph::insert
65 class FaceElement; // IWYU pragma: keep
66 class Graph; // IWYU pragma: keep
67 class NodeElement; // IWYU pragma: keep
68 
71 using node = NodeElement*;
72 
75 using edge = EdgeElement*;
76 
80 
81 
82 #if __cpp_concepts >= 201907
83 // clang-format off
84 template<typename T>
85 concept OGDF_NODE_FILTER = requires(T f) {
86  { f(node()) } -> std::convertible_to<bool>;
87 };
88 template<typename T>
89 concept OGDF_EDGE_FILTER = requires(T f) {
90  { f(edge()) } -> std::convertible_to<bool>;
91 };
92 template<typename T>
93 concept OGDF_NODE_ITER = std::forward_iterator<T> && requires(T i) {
94  { *i } -> std::convertible_to<node>;
95 };
96 template<typename T>
97 concept OGDF_EDGE_ITER = std::forward_iterator<T> && requires(T i) {
98  { *i } -> std::convertible_to<edge>;
99 };
100 using std::begin;
101 using std::end;
102 template<typename T>
103 concept OGDF_NODE_LIST = requires(T l) {
104  OGDF_NODE_ITER<decltype(begin(l))>;
105  OGDF_NODE_ITER<decltype(end(l))>;
106 };
107 template<typename T>
108 concept OGDF_EDGE_LIST = requires(T l) {
109  OGDF_EDGE_ITER<decltype(begin(l))>;
110  OGDF_EDGE_ITER<decltype(end(l))>;
111 };
112 // clang-format on
113 
114 # define OGDF_HAS_CONCEPTS
115 # define OGDF_CHECK_CONCEPT static_assert
116 
117 OGDF_CHECK_CONCEPT(OGDF_NODE_ITER<internal::GraphIterator<node>>);
118 OGDF_CHECK_CONCEPT(OGDF_EDGE_ITER<internal::GraphIterator<edge>>);
119 OGDF_CHECK_CONCEPT(OGDF_NODE_ITER<internal::GraphReverseIterator<node>>);
120 OGDF_CHECK_CONCEPT(OGDF_EDGE_ITER<internal::GraphReverseIterator<edge>>);
121 OGDF_CHECK_CONCEPT(OGDF_NODE_LIST<internal::GraphObjectContainer<NodeElement>>);
122 OGDF_CHECK_CONCEPT(OGDF_EDGE_LIST<internal::GraphObjectContainer<EdgeElement>>);
123 OGDF_CHECK_CONCEPT(OGDF_NODE_ITER<ListIteratorBase<node, false, false>>);
124 OGDF_CHECK_CONCEPT(OGDF_EDGE_ITER<ListIteratorBase<edge, false, true>>);
125 OGDF_CHECK_CONCEPT(OGDF_NODE_ITER<ListIteratorBase<node, true, false>>);
126 OGDF_CHECK_CONCEPT(OGDF_EDGE_ITER<ListIteratorBase<edge, true, false>>);
127 #else
128 # define OGDF_NODE_FILTER typename
129 # define OGDF_EDGE_FILTER typename
130 # define OGDF_NODE_ITER typename
131 # define OGDF_EDGE_ITER typename
132 # define OGDF_NODE_LIST typename
133 # define OGDF_EDGE_LIST typename
134 
135 # define OGDF_CHECK_CONCEPT(...)
136 #endif
137 
139 
144  friend class Graph;
147 
151  int m_id;
152 
154  explicit AdjElement(node v) : m_twin(nullptr), m_edge(nullptr), m_node(v), m_id(0) { }
155 
157  AdjElement(edge e, int id) : m_twin(nullptr), m_edge(e), m_node(nullptr), m_id(id) { }
158 
159 public:
161  edge theEdge() const { return m_edge; }
162 
164  operator edge() const { return m_edge; }
165 
167  node theNode() const { return m_node; }
168 
170  operator node() const { return m_node; }
171 
173  adjEntry twin() const { return m_twin; }
174 
176  node twinNode() const { return m_twin->m_node; }
177 
179  int index() const { return m_id; }
180 
182  bool isSource() const;
183 
194  bool isBetween(adjEntry adjBefore, adjEntry adjAfter) const;
195 
196  // traversing faces in clockwise (resp. counter-clockwise) order
197  // (if face is an interior face)
198 
200  adjEntry clockwiseFaceSucc() const { return m_twin->cyclicPred(); }
201 
203  adjEntry clockwiseFacePred() const { return cyclicSucc()->m_twin; }
204 
206  adjEntry counterClockwiseFaceSucc() const { return m_twin->cyclicSucc(); }
207 
209  adjEntry counterClockwiseFacePred() const { return cyclicPred()->m_twin; }
210 
211  // default is traversing faces in clockwise order
213  adjEntry faceCycleSucc() const { return clockwiseFaceSucc(); }
214 
216  adjEntry faceCyclePred() const { return clockwiseFacePred(); }
217 
219  adjEntry succ() const { return static_cast<adjEntry>(m_next); }
220 
222  adjEntry pred() const { return static_cast<adjEntry>(m_prev); }
223 
225  adjEntry cyclicSucc() const;
227  adjEntry cyclicPred() const;
228 
229 #ifdef OGDF_DEBUG
230  const Graph* graphOf() const;
231 #endif
232 
234  static int compare(const AdjElement& x, const AdjElement& y) { return x.m_id - y.m_id; }
236 
238 };
239 
242  friend class Graph;
244 
245  //GraphList<AdjElement> m_adjEdges; //!< The adjacency list of the node.
246  int m_indeg;
247  int m_outdeg;
248  int m_id;
249 
250 #ifdef OGDF_DEBUG
251  // we store the graph containing this node for debugging purposes
252  const Graph* m_pGraph;
253 #endif
254 
255 
257 #ifdef OGDF_DEBUG
258 
263  NodeElement(const Graph* pGraph, int id)
264  : m_indeg(0), m_outdeg(0), m_id(id), m_pGraph(pGraph) { }
265 #else
266  NodeElement(int id) : m_indeg(0), m_outdeg(0), m_id(id) { }
267 #endif
268 
269 
270 public:
273 
275  int index() const { return m_id; }
276 
278  int indeg() const { return m_indeg; }
279 
281  int outdeg() const { return m_outdeg; }
282 
284  int degree() const { return m_indeg + m_outdeg; }
285 
287  adjEntry firstAdj() const { return adjEntries.head(); }
288 
290  adjEntry lastAdj() const { return adjEntries.tail(); }
291 
293  node succ() const { return static_cast<node>(m_next); }
294 
296  node pred() const { return static_cast<node>(m_prev); }
297 
299 
303  template<class ADJLIST>
304  void allAdjEntries(ADJLIST& adjList) const {
305  adjList.clear();
306  for (adjEntry adj : this->adjEntries) {
307  adjList.pushBack(adj);
308  }
309  }
310 
312 
319  template<class EDGELIST>
320  void adjEdges(EDGELIST& edgeList) const {
321  edgeList.clear();
322  for (adjEntry adj : this->adjEntries) {
323  edgeList.pushBack(adj->theEdge());
324  }
325  }
326 
328 
332  template<class EDGELIST>
333  void inEdges(EDGELIST& edgeList) const;
334 
336 
340  template<class EDGELIST>
341  void outEdges(EDGELIST& edgeList) const;
342 
343 #ifdef OGDF_DEBUG
344  const Graph* graphOf() const { return m_pGraph; }
346 #endif
347 
349  static int compare(const NodeElement& x, const NodeElement& y) { return x.m_id - y.m_id; }
351 
353 };
354 
356  return (m_next) ? static_cast<adjEntry>(m_next) : m_node->firstAdj();
357 }
358 
360  return (m_prev) ? static_cast<adjEntry>(m_prev) : m_node->lastAdj();
361 }
362 
365  friend class Graph;
367 
372  int m_id; // The (unique) index of the edge.
373 
375 
382  EdgeElement(node src, node tgt, AdjElement* adjSrc, AdjElement* adjTgt, int id)
383  : m_src(src), m_tgt(tgt), m_adjSrc(adjSrc), m_adjTgt(adjTgt), m_id(id) { }
384 
386 
391  EdgeElement(node src, node tgt, int id)
392  : m_src(src), m_tgt(tgt), m_adjSrc(nullptr), m_adjTgt(nullptr), m_id(id) { }
393 
394 public:
396  int index() const { return m_id; }
397 
399  node source() const { return m_src; }
400 
402  node target() const { return m_tgt; }
403 
405  std::array<node, 2> nodes() const { return std::array<node, 2> {{m_src, m_tgt}}; }
406 
408  adjEntry adjSource() const { return m_adjSrc; }
409 
411  adjEntry adjTarget() const { return m_adjTgt; }
412 
414  node opposite(node v) const {
415  OGDF_ASSERT(isIncident(v));
416  return v == m_src ? m_tgt : m_src;
417  }
418 
420  bool isSelfLoop() const { return m_src == m_tgt; }
421 
423  bool isInvertedDirected(edge e) const { return m_src == e->target() && m_tgt == e->source(); }
424 
426  bool isParallelDirected(edge e) const { return m_src == e->source() && m_tgt == e->target(); }
427 
429  bool isParallelUndirected(edge e) const {
430  return isParallelDirected(e) || isInvertedDirected(e);
431  }
432 
434  edge succ() const { return static_cast<edge>(m_next); }
435 
437  edge pred() const { return static_cast<edge>(m_prev); }
438 
439 #ifdef OGDF_DEBUG
440  const Graph* graphOf() const { return m_src->graphOf(); }
442 #endif
443 
445  bool isIncident(node v) const { return v == m_src || v == m_tgt; }
446 
448  bool isAdjacent(edge e) const { return isIncident(e->m_src) || isIncident(e->m_tgt); }
449 
451  node commonNode(edge e) const {
452  return (m_src == e->m_src || m_src == e->m_tgt)
453  ? m_src
454  : ((m_tgt == e->m_src || m_tgt == e->m_tgt) ? m_tgt : nullptr);
455  }
456 
459  adjEntry getAdj(node v) const {
460  OGDF_ASSERT(this->isIncident(v));
461  return v == m_src ? m_adjSrc : m_adjTgt;
462  }
463 
465  static int compare(const EdgeElement& x, const EdgeElement& y) { return x.m_id - y.m_id; }
467 
469 
470 #ifdef OGDF_DEBUG
471 private:
472  bool m_hidden = false;
473 #endif
474 };
475 
476 #ifdef OGDF_DEBUG
477 inline const Graph* AdjElement::graphOf() const { return m_node->graphOf(); }
478 #endif
479 
480 inline bool AdjElement::isSource() const { return this == m_edge->adjSource(); }
481 
482 inline bool AdjElement::isBetween(adjEntry adjBefore, adjEntry adjAfter) const {
483 #ifdef OGDF_DEBUG
484  node v = this->theNode();
485  OGDF_ASSERT(adjBefore->theNode() == v);
486  OGDF_ASSERT(adjAfter->theNode() == v);
487 #endif
488  bool result = this != adjBefore && this != adjAfter && adjBefore != adjAfter;
489 
490  if (result) {
491  adjEntry adj = adjBefore;
492  for (; adj != this && adj != adjAfter; adj = adj->cyclicSucc()) {
493  ;
494  }
495  result = adj == this;
496  }
497 
498  return result;
499 }
500 
501 template<class EDGELIST>
502 void NodeElement::inEdges(EDGELIST& edgeList) const {
503  edgeList.clear();
504  for (adjEntry adj : this->adjEntries) {
505  edge e = adj->theEdge();
506  if (adj == e->adjTarget()) {
507  edgeList.pushBack(e);
508  }
509  }
510 }
511 
512 template<class EDGELIST>
513 void NodeElement::outEdges(EDGELIST& edgeList) const {
514  edgeList.clear();
515  for (adjEntry adj : this->adjEntries) {
516  edge e = adj->theEdge();
517  if (adj == e->adjSource()) {
518  edgeList.pushBack(e);
519  }
520  }
521 }
522 
527 
528 public:
531 
533  GraphAdjIterator(Graph* graph = nullptr, adjEntry entry = nullptr);
534 
537 
539  GraphAdjIterator end() { return GraphAdjIterator(m_pGraph); }
540 
542  void next();
543 
545  void prev();
546 
548  adjEntry operator*() const { return m_entry; }
549 
551  AdjElement& operator->() const { return *m_entry; }
552 
554  bool operator==(const GraphAdjIterator& iter) const {
555  return m_pGraph == iter.m_pGraph && m_entry == iter.m_entry;
556  }
557 
559  bool operator!=(const GraphAdjIterator& iter) const { return !operator==(iter); }
560 
563  next();
564  return *this;
565  }
566 
569  GraphAdjIterator iter = *this;
570  next();
571  return iter;
572  }
573 
576  prev();
577  return *this;
578  }
579 
582  GraphAdjIterator iter = *this;
583  prev();
584  return iter;
585  }
586 };
587 
588 namespace internal {
590 
597 template<typename Key, typename Iterable = GraphObjectContainer<Key>, int Factor = 1>
599  : public RegistryBase<Key*, GraphRegistry<Key, Iterable, Factor>, typename Iterable::iterator> {
602 
603 public:
604  using iterator = typename Iterable::iterator;
605 
607  GraphRegistry(Graph* graph, int* nextKeyIndex)
608  : m_pGraph(graph), m_nextKeyIndex(nextKeyIndex) { }
609 
610  static inline int keyToIndex(Key* key) { return key->index(); }
611 
612  bool isKeyAssociated(Key* key) const {
613  if (key == nullptr) {
614  return false;
615  }
616 #ifdef OGDF_DEBUG
617  if (key->graphOf() == m_pGraph) {
618  OGDF_ASSERT(keyToIndex(key) < this->getArraySize());
619  return true;
620  } else {
621  return false;
622  }
623 #else
624  return true;
625 #endif
626  }
627 
628  int calculateArraySize(int add) const {
629  return calculateTableSize((*m_nextKeyIndex + add) * Factor);
630  }
631 
632  int maxKeyIndex() const { return ((*m_nextKeyIndex) * Factor) - 1; }
633 
635  Graph* graphOf() const { return m_pGraph; }
636 };
637 
641 
642 #ifndef DOXYGEN_IGNORE
643 // doxygen has problems keeping these methods apart
645 
647 
649 
651 
653 
655 #endif
656 
658 template<typename Key, typename Value, bool WithDefault, typename Registry = GraphRegistry<Key>>
659 class GraphRegisteredArray : public RegisteredArray<Registry, Value, WithDefault, Graph> {
661 
662 public:
663  using RA::RA;
664 
666  Graph* graphOf() const {
667  if (RA::registeredAt() == nullptr) {
668  return nullptr;
669  } else {
670  return RA::registeredAt()->graphOf();
671  }
672  }
673 };
674 
676 template<typename Value, bool WithDefault>
677 class EdgeArrayBase1 : public GraphRegisteredArray<EdgeElement, Value, WithDefault> {
679 
680 public:
681  using GRA::GRA;
682 
683  using GRA::operator[];
684  using GRA::operator();
685 
687  const Value& operator[](adjEntry adj) const {
688  OGDF_ASSERT(adj != nullptr);
689  OGDF_ASSERT(GRA::getRegistry().isKeyAssociated(adj->theEdge()));
690  return GRA::operator[](adj->index() >> 1);
691  }
692 
694  Value& operator[](adjEntry adj) {
695  OGDF_ASSERT(adj != nullptr);
696  OGDF_ASSERT(GRA::getRegistry().isKeyAssociated(adj->theEdge()));
697  return GRA::operator[](adj->index() >> 1);
698  }
699 
701  const Value& operator()(adjEntry adj) const {
702  OGDF_ASSERT(adj != nullptr);
703  OGDF_ASSERT(GRA::getRegistry().isKeyAssociated(adj->theEdge()));
704  return GRA::operator[](adj->index() >> 1);
705  }
706 
708  Value& operator()(adjEntry adj) {
709  OGDF_ASSERT(adj != nullptr);
710  OGDF_ASSERT(GRA::getRegistry().isKeyAssociated(adj->theEdge()));
711  return GRA::operator[](adj->index() >> 1);
712  }
713 };
714 
716 template<typename Value, bool WithDefault>
717 class EdgeArrayBase2 : public EdgeArrayBase1<Value, WithDefault> {
718 public:
720 };
721 
722 template<bool WithDefault>
723 class EdgeArrayBase2<edge, WithDefault> : public EdgeArrayBase1<edge, WithDefault> {
725 
726 public:
727  using EA::EA;
728 
731  OGDF_ASSERT(adj != nullptr);
732  OGDF_ASSERT(EA::getRegistry().isKeyAssociated(adj->theEdge()));
733  edge e = EA::operator[](adj->index() >> 1);
734  return adj->isSource() ? e->adjSource() : e->adjTarget();
735  }
736 };
737 }
738 
739 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) internal::GraphRegisteredArray<NodeElement, v, c>
742 #undef OGDF_DECL_REG_ARRAY_TYPE
743 
744 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) internal::EdgeArrayBase2<v, c>
747 #undef OGDF_DECL_REG_ARRAY_TYPE
748 
749 #define OGDF_DECL_REG_ARRAY_TYPE(v, c) \
750  internal::GraphRegisteredArray<AdjElement, v, c, internal::GraphAdjRegistry>
753 #undef OGDF_DECL_REG_ARRAY_TYPE
754 
756 
775 class OGDF_EXPORT GraphObserver : public Observer<Graph, GraphObserver> {
776 public:
778  GraphObserver() = default;
779 
780  OGDF_DEPRECATED("calls registrationChanged with only partially-constructed child classes, "
781  "see copy constructor of Observer for fix")
782 
783  explicit GraphObserver(const Graph* G) { reregister(G); }
784 
786  virtual void nodeDeleted(node v) = 0;
787 
789  virtual void nodeAdded(node v) = 0;
790 
792  virtual void edgeDeleted(edge e) = 0;
793 
795  virtual void edgeAdded(edge e) = 0;
796 
798  virtual void cleared() = 0;
799 
800  const Graph* getGraph() const { return getObserved(); }
801 };
802 
803 namespace internal {
804 template<typename CONTAINER>
805 inline void getAllNodes(const Graph& G, CONTAINER& nodes);
806 template<typename CONTAINER>
807 inline void getAllEdges(const Graph& G, CONTAINER& edges);
808 
809 inline node adjToNode(adjEntry adj) { return adj->theNode(); }
810 
811 inline node adjToNode(node n) { return n; }
812 }
813 
815 OGDF_EXPORT bool filter_any_edge(edge e); // { return true; }
816 
818 OGDF_EXPORT bool filter_any_node(node n); // { return true; }
819 
821 
866 class OGDF_EXPORT Graph : public Observable<GraphObserver, Graph> {
867 public:
868  class CCsInfo; // IWYU pragma: keep
869  class HiddenEdgeSet; // IWYU pragma: keep
870 
871  friend class GraphObserver;
872 
873 private:
876 
880 
882 
883 public:
889 
897 
899 
903 
906  enum class EdgeType { association = 0, generalization = 1, dependency = 2 };
907 
909  enum class NodeType {
910  vertex = 0,
911  dummy = 1,
912  generalizationMerger = 2,
913  generalizationExpander = 3,
914  highDegreeExpander = 4,
915  lowDegreeExpander = 5,
916  associationClass = 6
917  };
918 
920 
921 
926 
930 
933 
935 
936 
938  Graph();
939 
941 
950 
952 
962 
964 
966  virtual ~Graph();
967 
969 
973 
976  bool empty() const { return nodes.empty(); }
977 
979  int numberOfNodes() const { return nodes.size(); }
980 
982  int numberOfEdges() const { return edges.size(); }
983 
985  int maxNodeIndex() const { return m_nodeIdCount - 1; }
986 
988  int maxEdgeIndex() const { return m_edgeIdCount - 1; }
989 
991  int maxAdjEntryIndex() const { return (m_edgeIdCount << 1) - 1; }
992 
994  node firstNode() const { return nodes.head(); }
995 
997  node lastNode() const { return nodes.tail(); }
998 
1000  edge firstEdge() const { return edges.head(); }
1001 
1003  edge lastEdge() const { return edges.tail(); }
1004 
1012  node chooseNode(
1013  std::function<bool(node)> includeNode = [](node) { return true; },
1014  bool isFastTest = true) const;
1015 
1023  edge chooseEdge(
1024  std::function<bool(edge)> includeEdge = [](edge) { return true; },
1025  bool isFastTest = true) const;
1026 
1028 
1032  template<class CONTAINER>
1033  void allNodes(CONTAINER& nodeContainer) const {
1034  internal::getAllNodes<CONTAINER>(*this, nodeContainer);
1035  }
1036 
1038 
1042  template<class CONTAINER>
1043  void allEdges(CONTAINER& edgeContainer) const {
1044  internal::getAllEdges<CONTAINER>(*this, edgeContainer);
1045  }
1046 
1048 
1051 
1054 
1061  node newNode(int index = -1) {
1062  node v = pureNewNode(index);
1063  m_regNodeArrays.keyAdded(v);
1064  for (GraphObserver* obs : getObservers()) {
1065  obs->nodeAdded(v);
1066  }
1067  return v;
1068  }
1069 
1071 
1080  inline edge newEdge(node v, node w, int index = -1) {
1081  return newEdge(v, Direction::after, w, Direction::after, index);
1082  }
1083 
1085 
1099  inline edge newEdge(node v, adjEntry adjTgt, int index = -1) {
1100  return newEdge(v, Direction::after, adjTgt, Direction::after, index);
1101  }
1102 
1104 
1118  inline edge newEdge(adjEntry adjSrc, node w, int index = -1) {
1119  return newEdge(adjSrc, Direction::after, w, Direction::after, index);
1120  }
1121 
1123 
1140  inline edge newEdge(adjEntry adjSrc, adjEntry adjTgt, Direction dir = Direction::after,
1141  int index = -1) {
1142  return newEdge(adjSrc, dir, adjTgt, dir, index);
1143  }
1144 
1146 
1164  template<typename S, typename T>
1165  edge newEdge(S src, Direction dirSrc, T tgt, Direction dirTgt, int index = -1) {
1166  OGDF_ASSERT(src != nullptr);
1167  OGDF_ASSERT(tgt != nullptr);
1168  edge e = pureNewEdge(internal::adjToNode(src), internal::adjToNode(tgt), index);
1169 
1170  insertAdjEntry(tgt, e->m_adjTgt, dirTgt);
1171  insertAdjEntry(src, e->m_adjSrc, dirSrc);
1172 
1173  m_regEdgeArrays.keyAdded(e);
1174  m_regAdjArrays.keyAdded(e->adjSource());
1175  m_regAdjArrays.keyAdded(e->adjTarget());
1176  for (GraphObserver* obs : getObservers()) {
1177  obs->edgeAdded(e);
1178  }
1179 
1180  return e;
1181  }
1182 
1184 
1187 
1190  virtual void delNode(node v);
1191 
1193  virtual void delEdge(edge e);
1194 
1196  virtual void clear();
1197 
1199  void restoreAllEdges();
1200 
1202 
1223  friend class Graph;
1224  friend class EdgeElement;
1225 
1226  public:
1232  explicit HiddenEdgeSet(Graph& graph) : m_graph(&graph) {
1233  m_it = m_graph->m_hiddenEdgeSets.pushFront(this);
1234  }
1235 
1240  if (m_graph) {
1241  restore();
1242  m_graph->m_hiddenEdgeSets.del(m_it);
1243  }
1244  }
1245 
1252  void hide(edge e);
1253 
1260  void restore(edge e);
1261 
1268  void restore();
1269 
1271  int size();
1272 
1274  bool empty();
1275 
1278 
1281 
1282  private:
1286 
1288  };
1289 
1293 
1296 
1305  virtual edge split(edge e);
1306 
1308 
1317  void unsplit(node u);
1318 
1320 
1331  virtual void unsplit(edge eIn, edge eOut);
1332 
1334 
1355  node splitNode(adjEntry adjStartLeft, adjEntry adjStartRight);
1356 
1358 
1366  node contract(edge e, bool keepSelfLoops = false);
1367 
1369 
1383  void move(edge e, adjEntry adjSrc, Direction dirSrc, adjEntry adjTgt, Direction dirTgt);
1384 
1386 
1392  void moveTarget(edge e, node w);
1393 
1395 
1403  void moveTarget(edge e, adjEntry adjTgt, Direction dir);
1404 
1406 
1412  void moveSource(edge e, node w);
1413 
1415 
1423  void moveSource(edge e, adjEntry adjSrc, Direction dir);
1424 
1426 
1434  edge searchEdge(node v, node w, bool directed = false) const;
1435 
1437  void reverseEdge(edge e);
1438 
1440  void reverseAllEdges();
1441 
1443 
1449  template<class NODELIST>
1450  void collapse(NODELIST& nodesToCollapse) {
1451  node v = nodesToCollapse.popFrontRet();
1452  while (!nodesToCollapse.empty()) {
1453  node w = nodesToCollapse.popFrontRet();
1454  adjEntry adj = w->firstAdj();
1455  while (adj != nullptr) {
1456  adjEntry succ = adj->succ();
1457  edge e = adj->theEdge();
1458  if (e->source() == v || e->target() == v) {
1459  delEdge(e);
1460  } else if (e->source() == w) {
1461  moveSource(e, v);
1462  } else {
1463  moveTarget(e, v);
1464  }
1465  adj = succ;
1466  }
1467  delNode(w);
1468  }
1469  }
1470 
1472 
1479  template<class ADJ_ENTRY_LIST>
1480  void sort(node v, const ADJ_ENTRY_LIST& newOrder) {
1481  using std::begin;
1482  using std::end;
1483  sort(v, begin(newOrder), end(newOrder));
1484  }
1485 
1487 
1495  template<class IT>
1496  void sort(node v, IT begin, IT end) {
1497 #ifdef OGDF_DEBUG
1498  std::set<int> entries;
1499  int counter = 0;
1500 
1501  for (auto it = begin; it != end; ++it) {
1502  adjEntry adj = *it;
1503  entries.insert(adj->index());
1504  OGDF_ASSERT(adj->theNode() == v);
1505  counter++;
1506  }
1507 
1508  OGDF_ASSERT(counter == v->degree());
1509  OGDF_ASSERT(entries.size() == static_cast<unsigned int>(v->degree()));
1510 #endif
1511  v->adjEntries.sort(begin, end);
1512  }
1513 
1515 
1518  void reverseAdjEdges(node v) { v->adjEntries.reverse(); }
1519 
1521 
1528  void moveAdj(adjEntry adjMove, Direction dir, adjEntry adjPos) {
1529  OGDF_ASSERT(adjMove != nullptr);
1530  OGDF_ASSERT(adjPos != nullptr);
1531  OGDF_ASSERT(adjMove->graphOf() == this);
1532  OGDF_ASSERT(adjPos->graphOf() == this);
1533  internal::GraphList<AdjElement>& adjList = adjMove->m_node->adjEntries;
1534  adjList.move(adjMove, adjList, adjPos, dir);
1535  }
1536 
1538 
1544  void moveAdjAfter(adjEntry adjMove, adjEntry adjAfter) {
1545  OGDF_ASSERT(adjMove != nullptr);
1546  OGDF_ASSERT(adjAfter != nullptr);
1547  OGDF_ASSERT(adjMove->graphOf() == this);
1548  OGDF_ASSERT(adjAfter->graphOf() == this);
1549  adjMove->m_node->adjEntries.moveAfter(adjMove, adjAfter);
1550  }
1551 
1553 
1559  void moveAdjBefore(adjEntry adjMove, adjEntry adjBefore) {
1560  OGDF_ASSERT(adjMove != nullptr);
1561  OGDF_ASSERT(adjBefore != nullptr);
1562  OGDF_ASSERT(adjMove->graphOf() == this);
1563  OGDF_ASSERT(adjBefore->graphOf() == this);
1564  adjMove->m_node->adjEntries.moveBefore(adjMove, adjBefore);
1565  }
1566 
1568  void reverseAdjEdges();
1569 
1571 
1577  void swapAdjEdges(adjEntry adj1, adjEntry adj2) {
1578  OGDF_ASSERT(adj1->theNode() == adj2->theNode());
1579  OGDF_ASSERT(adj1->graphOf() == this);
1580 
1581  adj1->theNode()->adjEntries.swap(adj1, adj2);
1582  }
1583 
1585 
1588 
1591 
1601  int genus() const;
1602 
1604 
1607  bool representsCombEmbedding() const { return genus() == 0; }
1608 
1609 #ifdef OGDF_DEBUG
1610  void consistencyCheck() const;
1612 #endif
1613 
1615 
1620 
1623  internal::GraphNodeRegistry& nodeRegistry() { return m_regNodeArrays; }
1624 
1626  const internal::GraphNodeRegistry& nodeRegistry() const { return m_regNodeArrays; }
1627 
1628  operator const internal::GraphNodeRegistry&() const { return m_regNodeArrays; }
1629 
1631  internal::GraphEdgeRegistry& edgeRegistry() { return m_regEdgeArrays; }
1632 
1634  const internal::GraphEdgeRegistry& edgeRegistry() const { return m_regEdgeArrays; }
1635 
1636  operator const internal::GraphEdgeRegistry&() const { return m_regEdgeArrays; }
1637 
1639  internal::GraphAdjRegistry& adjEntryRegistry() { return m_regAdjArrays; }
1640 
1642  const internal::GraphAdjRegistry& adjEntryRegistry() const { return m_regAdjArrays; }
1643 
1644  operator const internal::GraphAdjRegistry&() const { return m_regAdjArrays; }
1645 
1647 
1672  void resetEdgeIdCount(int maxId);
1673 
1674  void resetNodeIdCount(int maxId);
1675 
1676 
1678 
1681 
1716  template<OGDF_NODE_ITER NI, OGDF_EDGE_ITER EI, bool copyEmbedding = true, bool copyIDs = false,
1717  bool notifyObservers = true>
1718  std::pair<int, int> insert(const NI& nodesBegin, const NI& nodesEnd, const EI& edgesBegin,
1719  const EI& edgesEnd, NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap);
1720 
1748  template<OGDF_NODE_ITER NI, OGDF_EDGE_FILTER EF, bool copyIDs = false, bool notifyObservers = true>
1749  std::pair<int, int> insert(const NI& nodesBegin, const NI& nodesEnd, const EF& edgeFilter,
1750  NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap);
1751 
1752  // List short-cuts
1753 
1760  template<OGDF_NODE_LIST NL>
1761  std::pair<int, int> insert(const NL& nodeList, const EdgeSet& edgeSet, NodeArray<node>& nodeMap,
1762  EdgeArray<edge>& edgeMap);
1763 
1770  template<OGDF_NODE_LIST NL, OGDF_EDGE_LIST EL>
1771  std::pair<int, int> insert(const NL& nodeList, const EL& edgeList, NodeArray<node>& nodeMap,
1772  EdgeArray<edge>& edgeMap) {
1773  m_regNodeArrays.reserveSpace(nodeList.size());
1774  m_regEdgeArrays.reserveSpace(edgeList.size());
1775  m_regAdjArrays.reserveSpace(edgeList.size());
1776  using std::begin;
1777  using std::end;
1778  return insert(begin(nodeList), end(nodeList), begin(edgeList), end(edgeList), nodeMap,
1779  edgeMap);
1780  }
1781 
1782  // Often-used special cases
1783 
1790  std::pair<int, int> insert(const CCsInfo& info, int cc, NodeArray<node>& nodeMap,
1791  EdgeArray<edge>& edgeMap) {
1792  OGDF_ASSERT(&(info.constGraph()) == nodeMap.registeredAt()->graphOf());
1793  OGDF_ASSERT(&(info.constGraph()) == edgeMap.registeredAt()->graphOf());
1794  m_regNodeArrays.reserveSpace(info.numberOfNodes(cc));
1795  m_regEdgeArrays.reserveSpace(info.numberOfEdges(cc));
1796  m_regAdjArrays.reserveSpace(info.numberOfEdges(cc));
1797  auto count = insert(info.nodes(cc).begin(), info.nodes(cc).end(), filter_any_edge, nodeMap,
1798  edgeMap);
1799  OGDF_ASSERT(count.first == info.numberOfNodes(cc));
1800  OGDF_ASSERT(count.second == info.numberOfEdges(cc));
1801  return count;
1802  }
1803 
1810  std::pair<int, int> insert(const Graph& G, NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap) {
1811  if (!nodeMap.registeredAt()) {
1812  nodeMap.init(G);
1813  }
1814  OGDF_ASSERT(nodeMap.registeredAt()->graphOf() == &G);
1815  if (!edgeMap.registeredAt()) {
1816  edgeMap.init(G);
1817  }
1818  OGDF_ASSERT(edgeMap.registeredAt()->graphOf() == &G);
1819  m_regNodeArrays.reserveSpace(G.numberOfNodes());
1820  m_regEdgeArrays.reserveSpace(G.numberOfEdges());
1821  m_regAdjArrays.reserveSpace(G.numberOfEdges());
1822  auto count = insert(G.nodes.begin(), G.nodes.end(), filter_any_edge, nodeMap, edgeMap);
1823  OGDF_ASSERT(count.first == G.numberOfNodes());
1824  OGDF_ASSERT(count.second == G.numberOfEdges());
1825  return count;
1826  }
1827 
1834  std::pair<int, int> insert(const Graph& G) {
1835  NodeArray<node> nodeMap(G, nullptr);
1836  EdgeArray<edge> edgeMap(G, nullptr);
1837  return insert(G, nodeMap, edgeMap);
1838  }
1839 
1840 private:
1841  template<OGDF_NODE_ITER NI, bool notifyObservers, bool copyIDs>
1842  void insertNodes(const NI& nodesBegin, const NI& nodesEnd, NodeArray<node, true>& nodeMap,
1843  int& newNodes, void* cbData);
1844 
1845 protected:
1861  virtual void* preInsert(bool copyEmbedding, bool copyIDs, bool notifyObservers, bool edgeFilter,
1862  NodeArray<node>& nodeMap, EdgeArray<edge>& edgeMap, int* newNodes, int* newEdges) {
1863  return nullptr;
1864  };
1865 
1873  virtual void nodeInserted(void* userData, node original, node copy) {};
1874 
1882  virtual void edgeInserted(void* userData, edge original, edge copy) {};
1883 
1891  virtual void postInsert(void* userData, int newNodes, int newEdges) {};
1893 
1894 public:
1897  const Graph* m_graph;
1898  int m_numCC;
1899 
1904 
1905  public:
1907  CCsInfo() : m_graph(nullptr), m_numCC(0) { }
1908 
1910  explicit CCsInfo(const Graph& G);
1911 
1913  const Graph& constGraph() const { return *m_graph; }
1914 
1916  int numberOfCCs() const { return m_numCC; }
1917 
1919  int numberOfNodes(int cc) const { return stopNode(cc) - startNode(cc); }
1920 
1922  int numberOfEdges(int cc) const { return stopEdge(cc) - startEdge(cc); }
1923 
1925  int startNode(int cc) const { return m_startNode[cc]; }
1926 
1928  int stopNode(int cc) const { return m_startNode[cc + 1]; }
1929 
1931  return {m_nodes.begin() + startNode(cc), m_nodes.begin() + stopNode(cc)};
1932  }
1933 
1935  return {m_edges.begin() + startEdge(cc), m_edges.begin() + stopEdge(cc)};
1936  }
1937 
1939  int startEdge(int cc) const { return m_startEdge[cc]; }
1940 
1942  int stopEdge(int cc) const { return m_startEdge[cc + 1]; }
1943 
1945  node v(int i) const { return m_nodes[i]; }
1946 
1948  edge e(int i) const { return m_edges[i]; }
1949  };
1950 
1951 private:
1959  inline node pureNewNode(int index) {
1960  if (index < 0) {
1961  index = m_nodeIdCount++;
1962  } else {
1963  m_nodeIdCount = max(m_nodeIdCount, index + 1);
1964  }
1965 
1966  // simple check against illegal index reuse
1967  OGDF_ASSERT(nodes.empty() || index != nodes.head()->index());
1968  OGDF_ASSERT(nodes.empty() || index != nodes.tail()->index());
1969 
1970 #ifdef OGDF_DEBUG
1971  node v = new NodeElement(this, index);
1972 #else
1973  node v = new NodeElement(index);
1974 #endif
1975  nodes.pushBack(v);
1976  return v;
1977  }
1978 
1990  edge pureNewEdge(node src, node tgt, int index) {
1991  OGDF_ASSERT(src != nullptr);
1992  OGDF_ASSERT(tgt != nullptr);
1993  OGDF_ASSERT(src->graphOf() == this);
1994  OGDF_ASSERT(tgt->graphOf() == this);
1995 
1996  if (index < 0) {
1997  index = m_edgeIdCount++;
1998  } else {
1999  m_edgeIdCount = max(m_edgeIdCount, index + 1);
2000  }
2001 
2002  // simple check against illegal index reuse
2003  OGDF_ASSERT(edges.empty() || index != edges.head()->index());
2004  OGDF_ASSERT(edges.empty() || index != edges.tail()->index());
2005 
2006  edge e = new EdgeElement(src, tgt, index);
2007  edges.pushBack(e);
2008 
2009  e->m_adjSrc = new AdjElement(e, index << 1);
2010  e->m_adjTgt = new AdjElement(e, (index << 1) | 1);
2011 
2012  e->m_adjSrc->m_twin = e->m_adjTgt;
2013  e->m_adjSrc->m_node = src;
2014  src->m_outdeg++;
2015 
2016  e->m_adjTgt->m_twin = e->m_adjSrc;
2017  e->m_adjTgt->m_node = tgt;
2018  tgt->m_indeg++;
2019 
2020  return e;
2021  }
2022 
2023  static inline void insertAdjEntry(adjEntry oldAdj, adjEntry newAdj, Direction dir) {
2024  if (dir == Direction::after) {
2025  oldAdj->theNode()->adjEntries.insertAfter(newAdj, oldAdj);
2026  } else {
2027  oldAdj->theNode()->adjEntries.insertBefore(newAdj, oldAdj);
2028  }
2029  }
2030 
2031  static inline void insertAdjEntry(node n, adjEntry newAdj, Direction dir) {
2032  if (dir == Direction::after || n->adjEntries.empty()) {
2033  n->adjEntries.pushBack(newAdj);
2034  } else {
2035  n->adjEntries.insertBefore(newAdj, n->adjEntries.head());
2036  }
2037  }
2038 
2040  void moveAdj(adjEntry adj, node w);
2041 };
2042 
2043 OGDF_EXPORT std::ostream& operator<<(std::ostream& os, const Graph::EdgeType& et);
2044 
2047 public:
2049  int getBucket(const edge& e) override { return e->source()->index(); }
2050 };
2051 
2054 public:
2056  int getBucket(const edge& e) override { return e->target()->index(); }
2057 };
2058 
2059 namespace internal {
2060 
2061 template<typename CONTAINER>
2062 inline void getAllNodes(const Graph& G, CONTAINER& nodes) {
2063  nodes.clear();
2064  for (node v : G.nodes) {
2065  nodes.pushBack(v);
2066  }
2067 }
2068 
2069 template<>
2070 inline void getAllNodes(const Graph& G, Array<node>& nodes) {
2071  nodes.init(G.numberOfNodes());
2072  int i = 0;
2073  for (node v : G.nodes) {
2074  nodes[i++] = v;
2075  }
2076 }
2077 
2078 template<typename CONTAINER>
2079 inline void getAllEdges(const Graph& G, CONTAINER& edges) {
2080  edges.clear();
2081  for (edge v : G.edges) {
2082  edges.pushBack(v);
2083  }
2084 }
2085 
2086 template<>
2087 inline void getAllEdges(const Graph& G, Array<edge>& edges) {
2088  edges.init(G.numberOfEdges());
2089  int i = 0;
2090  for (edge v : G.edges) {
2091  edges[i++] = v;
2092  }
2093 }
2094 
2095 }
2096 
2097 struct NodePair {
2098  node source = nullptr;
2099  node target = nullptr;
2100  NodePair() = default;
2101 
2102  NodePair(node src, node tgt) : source(src), target(tgt) { }
2103 };
2104 
2105 inline std::ostream& operator<<(std::ostream& os, const NodePair& np) {
2106  os << "(" << np.source << "," << np.target << ")";
2107  return os;
2108 }
2109 
2110 }
2111 
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:708
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:61
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::RegisteredArray
Dynamic arrays indexed with arbitrary keys.
Definition: RegisteredArray.h:869
OGDF_DECL_REG_ARRAY
#define OGDF_DECL_REG_ARRAY(NAME)
Definition: RegisteredArray.h:1021
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:881
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:976
ogdf::Graph::CCsInfo::numberOfEdges
int numberOfEdges(int cc) const
Returns the number of edges in connected component cc.
Definition: Graph_d.h:1922
ogdf::Graph::adjEntryRegistry
internal::GraphAdjRegistry & adjEntryRegistry()
Returns a reference to the registry of adjEntry arrays associated with this graph.
Definition: Graph_d.h:1639
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:1480
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:1834
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:1959
ogdf::GraphObserver::getGraph
const Graph * getGraph() const
Definition: Graph_d.h:800
ogdf::Graph::CCsInfo
Info structure for maintaining connected components.
Definition: Graph_d.h:1896
ogdf::AdjElement::pred
adjEntry pred() const
Returns the predecessor in the adjacency list.
Definition: Graph_d.h:222
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:1990
ogdf::internal::GraphRegisteredArray::graphOf
Graph * graphOf() const
Returns a pointer to the associated graph.
Definition: Graph_d.h:666
ogdf::GraphAdjIterator::m_pGraph
Graph * m_pGraph
Definition: Graph_d.h:525
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:2031
ogdf::GraphAdjIterator::operator!=
bool operator!=(const GraphAdjIterator &iter) const
Inequality operator.
Definition: Graph_d.h:559
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:1930
ogdf::Graph::edgeRegistry
internal::GraphEdgeRegistry & edgeRegistry()
Returns a reference to the registry of edge arrays associated with this graph.
Definition: Graph_d.h:1631
ogdf::Graph::CCsInfo::e
edge e(int i) const
Returns the edge with index i.
Definition: Graph_d.h:1948
ogdf::AdjElement::theNode
node theNode() const
Returns the node whose adjacency list contains this element.
Definition: Graph_d.h:167
ogdf::NodeElement::m_indeg
int m_indeg
The indegree of the node.
Definition: Graph_d.h:246
ogdf::Graph::maxEdgeIndex
int maxEdgeIndex() const
Returns the largest used edge index.
Definition: Graph_d.h:988
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:429
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:1942
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:2079
OGDF_DEPRECATED
#define OGDF_DEPRECATED(reason)
Mark a class / member / function as deprecated.
Definition: config.h:206
ogdf::Graph::HiddenEdgeSet::HiddenEdgeSet
HiddenEdgeSet(Graph &graph)
Creates a new set of hidden edges.
Definition: Graph_d.h:1232
ogdf::internal::GraphRegistry::GraphRegistry
GraphRegistry(Graph *graph, int *nextKeyIndex)
Constructor.
Definition: Graph_d.h:607
ogdf::AdjElement::counterClockwiseFaceSucc
adjEntry counterClockwiseFaceSucc() const
Returns the counter-clockwise successor in face.
Definition: Graph_d.h:206
ogdf::Graph::EdgeType
EdgeType
The type of edges (only used in derived classes).
Definition: Graph_d.h:906
ogdf::RegisteredArray::RA
typename std::conditional< WithDefault, internal::RegisteredArrayWithDefault< Registry, Value >, internal::RegisteredArrayWithoutDefault< Registry, Value > >::type RA
Definition: RegisteredArray.h:874
ogdf::Graph::swapAdjEdges
void swapAdjEdges(adjEntry adj1, adjEntry adj2)
Exchanges two entries in an adjacency list.
Definition: Graph_d.h:1577
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:1902
ogdf::NodeElement::lastAdj
adjEntry lastAdj() const
Returns the last entry in the adjacency list.
Definition: Graph_d.h:290
ogdf::Graph::HiddenEdgeSet
Functionality for temporarily hiding edges in constant time.
Definition: Graph_d.h:1222
ogdf::NodeElement::index
int index() const
Returns the (unique) node index.
Definition: Graph_d.h:275
ogdf::Graph::CCsInfo::constGraph
const Graph & constGraph() const
Returns the associated graph.
Definition: Graph_d.h:1913
ogdf::internal::getAllNodes
void getAllNodes(const Graph &G, CONTAINER &nodes)
Definition: Graph_d.h:2062
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:359
ogdf::NodePair
Definition: Graph_d.h:2097
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:746
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:1642
ogdf::Graph::moveAdjBefore
void moveAdjBefore(adjEntry adjMove, adjEntry adjBefore)
Moves adjacency entry adjMove before adjBefore.
Definition: Graph_d.h:1559
ogdf::Graph::allNodes
void allNodes(CONTAINER &nodeContainer) const
Returns a container with all nodes of the graph.
Definition: Graph_d.h:1033
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:426
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:1544
ogdf::Graph::m_regEdgeArrays
internal::GraphEdgeRegistry m_regEdgeArrays
The registered edge arrays.
Definition: Graph_d.h:878
ogdf::GraphAdjIterator::operator--
GraphAdjIterator operator--(int)
Decrement operator (postfix).
Definition: Graph_d.h:581
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:423
ogdf::internal::GraphRegistry::graphOf
Graph * graphOf() const
Returns a pointer to the associated graph.
Definition: Graph_d.h:635
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:1626
ogdf::EdgeElement::index
int index() const
Returns the index of the edge.
Definition: Graph_d.h:396
ogdf::NodePair::source
node source
Definition: Graph_d.h:2098
ogdf::GraphAdjIterator
Iterator for AdjEntries of a graph.
Definition: Graph_d.h:524
ogdf::Graph::CCsInfo::m_startEdge
Array< int > m_startEdge
start edge of each connected component in m_edges.
Definition: Graph_d.h:1903
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:502
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:1810
OGDF_CHECK_CONCEPT
#define OGDF_CHECK_CONCEPT(...)
Definition: Graph_d.h:135
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:1496
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:2049
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:296
ogdf::EdgeElement::m_src
node m_src
The source node of the edge.
Definition: Graph_d.h:368
OGDF_EDGE_ITER
#define OGDF_EDGE_ITER
Definition: Graph_d.h:131
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:730
ogdf::Graph::CCsInfo::m_numCC
int m_numCC
the number of connected components.
Definition: Graph_d.h:1898
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:477
ogdf::GraphAdjIterator::operator++
GraphAdjIterator operator++(int)
Increment operator (postfix).
Definition: Graph_d.h:568
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:1891
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:1043
ogdf::AdjElement::twin
adjEntry twin() const
Returns the corresponding adjacency element associated with the same edge.
Definition: Graph_d.h:173
ogdf::NodeArray
internal::GraphRegisteredArray< NodeElement, Value, WithDefault > NodeArray
RegisteredArray for labeling the nodes in a Graph with an arbitrary Value.
Definition: Graph_d.h:741
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:1284
ogdf::GraphAdjIterator::end
GraphAdjIterator end()
Returns an iterator to the one-past-last adjEntry in the associated graph.
Definition: Graph_d.h:539
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:1634
ogdf::AdjElement::m_edge
edge m_edge
The associated edge.
Definition: Graph_d.h:149
ogdf::EdgeElement::EdgeElement
EdgeElement(node src, node tgt, int id)
Constructs an edge element (src,tgt).
Definition: Graph_d.h:391
OGDF_NODE_FILTER
#define OGDF_NODE_FILTER
Definition: Graph_d.h:128
ogdf::Graph::CCsInfo::edges
internal::SimpleRange< Array< edge >::const_iterator > edges(int cc) const
Definition: Graph_d.h:1934
ogdf::Graph::nodeInserted
virtual void nodeInserted(void *userData, node original, node copy)
Callback notifying subclasses that insert() copied a node.
Definition: Graph_d.h:1873
ogdf::NodeElement::m_outdeg
int m_outdeg
The outdegree of the node.
Definition: Graph_d.h:247
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:1790
ogdf::adjEntry
AdjElement * adjEntry
The type of adjacency entries.
Definition: Graph_d.h:79
ogdf::Graph::CCsInfo::v
node v(int i) const
Returns the node with index i.
Definition: Graph_d.h:1945
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:216
ogdf::internal::GraphRegistry::keyToIndex
static int keyToIndex(Key *key)
Definition: Graph_d.h:610
ogdf::Graph::CCsInfo::CCsInfo
CCsInfo()
Creates a info structure associated with no graph.
Definition: Graph_d.h:1907
ogdf::Graph::insertAdjEntry
static void insertAdjEntry(adjEntry oldAdj, adjEntry newAdj, Direction dir)
Definition: Graph_d.h:2023
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:143
ogdf::NodeElement::m_pGraph
const Graph * m_pGraph
The graph containg this node (debug only).
Definition: Graph_d.h:252
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:480
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:1118
ogdf::NodeElement::compare
static int compare(const NodeElement &x, const NodeElement &y)
Standard Comparer.
Definition: Graph_d.h:349
ogdf::Graph::nodeRegistry
internal::GraphNodeRegistry & nodeRegistry()
Returns a reference to the registry of node arrays associated with this graph.
Definition: Graph_d.h:1623
ogdf::AdjElement::clockwiseFacePred
adjEntry clockwiseFacePred() const
Returns the clockwise predecessor in face. Use faceCycleSucc instead!
Definition: Graph_d.h:203
ogdf::edge
EdgeElement * edge
The type of edges.
Definition: Graph_d.h:75
Minisat::Internal::sort
void sort(T *array, int size, LessThan lt)
Definition: Sort.h:58
ogdf::internal::GraphRegistry::m_pGraph
Graph * m_pGraph
Definition: Graph_d.h:600
ogdf::AdjElement::theEdge
edge theEdge() const
Returns the edge associated with this adjacency entry.
Definition: Graph_d.h:161
ogdf::Observable
Base class for an observable object that can be tracked by multiple Observer objects.
Definition: Observer.h:127
OGDF_NODE_ITER
#define OGDF_NODE_ITER
Definition: Graph_d.h:130
ogdf::EdgeElement::m_adjTgt
AdjElement * m_adjTgt
Corresponding adjacency entry at target node.
Definition: Graph_d.h:371
ogdf::Direction::after
@ after
ogdf::GraphAdjIterator::operator--
GraphAdjIterator & operator--()
Decrement operator (prefix).
Definition: Graph_d.h:575
ogdf::Graph::nodes
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
Definition: Graph_d.h:929
Minisat::Internal::copy
static void copy(const T &from, T &to)
Definition: Alg.h:62
ogdf::EdgeElement::isSelfLoop
bool isSelfLoop() const
Returns true iff the edge is a self-loop (source node = target node).
Definition: Graph_d.h:420
ogdf::Graph::reverseAdjEdges
void reverseAdjEdges(node v)
Reverses the adjacency list of v.
Definition: Graph_d.h:1518
ogdf::Graph::numberOfEdges
int numberOfEdges() const
Returns the number of edges in the graph.
Definition: Graph_d.h:982
ogdf::NodeElement::outdeg
int outdeg() const
Returns the outdegree of the node.
Definition: Graph_d.h:281
ogdf::BucketTargetIndex::getBucket
int getBucket(const edge &e) override
Returns target index of e.
Definition: Graph_d.h:2056
ogdf::NodeElement::degree
int degree() const
Returns the degree of the node (indegree + outdegree).
Definition: Graph_d.h:284
ogdf::AdjElement::clockwiseFaceSucc
adjEntry clockwiseFaceSucc() const
Returns the clockwise successor in face. Use faceCycleSucc instead!
Definition: Graph_d.h:200
ogdf::Graph::m_edgeIdCount
int m_edgeIdCount
The Index that will be assigned to the next created edge.
Definition: Graph_d.h:875
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:809
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:1928
ogdf::Graph::numberOfNodes
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition: Graph_d.h:979
ogdf::AdjElement::AdjElement
AdjElement(node v)
Constructs an adjacency element for a given node.
Definition: Graph_d.h:154
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:752
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:219
ogdf::NodeElement::adjEntries
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
Definition: Graph_d.h:272
OGDF_EDGE_FILTER
#define OGDF_EDGE_FILTER
Definition: Graph_d.h:129
ogdf::calculateTableSize
int calculateTableSize(int actualCount)
The default growth function for registered arrays.
Definition: RegisteredArray.h:70
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:278
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:1165
ogdf::BucketSourceIndex
Bucket function using the index of an edge's source node as bucket.
Definition: Graph_d.h:2046
ogdf::EdgeSet
Edge sets.
Definition: GraphSets.h:86
ogdf::Graph::HiddenEdgeSet::m_edges
internal::GraphList< EdgeElement > m_edges
Definition: Graph_d.h:1283
ogdf::NodePair::target
node target
Definition: Graph_d.h:2099
ogdf::Graph::firstNode
node firstNode() const
Returns the first node in the list of all nodes.
Definition: Graph_d.h:994
ogdf::Graph::HiddenEdgeSet::~HiddenEdgeSet
~HiddenEdgeSet()
Restores all hidden edges.
Definition: Graph_d.h:1239
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:482
ogdf::internal::GraphRegistry::isKeyAssociated
bool isKeyAssociated(Key *key) const
Definition: Graph_d.h:612
ogdf::Graph::maxNodeIndex
int maxNodeIndex() const
Returns the largest used node index.
Definition: Graph_d.h:985
ogdf::EdgeElement::pred
edge pred() const
Returns the predecessor in the list of all edges.
Definition: Graph_d.h:437
ogdf::internal::GraphRegistry::m_nextKeyIndex
int * m_nextKeyIndex
Definition: Graph_d.h:601
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:2053
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:399
ogdf::node
NodeElement * node
The type of nodes.
Definition: Graph_d.h:71
ogdf::GraphObserver
Abstract Base class for graph observers.
Definition: Graph_d.h:775
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:659
ogdf::RegistryBase::keyAdded
void keyAdded(Key key)
Records the addition of a new key and resizes all registered arrays if necessary.
Definition: RegisteredArray.h:203
ogdf::EdgeElement::adjSource
adjEntry adjSource() const
Returns the corresponding adjacancy entry at source node.
Definition: Graph_d.h:408
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:866
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:687
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:1861
ogdf::Graph::CCsInfo::numberOfNodes
int numberOfNodes(int cc) const
Returns the number of nodes in connected component cc.
Definition: Graph_d.h:1919
ogdf::Graph::lastNode
node lastNode() const
Returns the last node in the list of all nodes.
Definition: Graph_d.h:997
ogdf::AdjElement::m_id
int m_id
The (unique) index of the adjacency entry.
Definition: Graph_d.h:151
ogdf::Graph::NodeType
NodeType
The type of nodes.
Definition: Graph_d.h:909
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:1003
ogdf::AdjElement::twinNode
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Definition: Graph_d.h:176
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:459
ogdf::AdjElement::cyclicSucc
adjEntry cyclicSucc() const
Returns the cyclic successor in the adjacency list.
Definition: Graph_d.h:355
ogdf::AdjElement::m_twin
AdjElement * m_twin
The corresponding adjacency entry (same edge)
Definition: Graph_d.h:148
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:874
ogdf::EdgeElement::adjTarget
adjEntry adjTarget() const
Returns the corresponding adjacancy entry at target node.
Definition: Graph_d.h:411
ogdf::GraphAdjIterator::m_entry
adjEntry m_entry
Definition: Graph_d.h:526
ogdf::EdgeElement::m_adjSrc
AdjElement * m_adjSrc
Corresponding adjacency entry at source node.
Definition: Graph_d.h:370
ogdf::Graph::representsCombEmbedding
bool representsCombEmbedding() const
Returns true iff the graph represents a combinatorial embedding.
Definition: Graph_d.h:1607
ogdf::NodeElement::allAdjEntries
void allAdjEntries(ADJLIST &adjList) const
Returns a list with all adjacency entries of this node.
Definition: Graph_d.h:304
ogdf::NodePair::NodePair
NodePair(node src, node tgt)
Definition: Graph_d.h:2102
ogdf::NodeElement::adjEdges
void adjEdges(EDGELIST &edgeList) const
Returns a list with all edges incident to this node.
Definition: Graph_d.h:320
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:1140
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:1000
ogdf::Graph::edges
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Definition: Graph_d.h:932
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:554
ogdf::AdjElement::compare
static int compare(const AdjElement &x, const AdjElement &y)
Standard Comparer.
Definition: Graph_d.h:234
OGDF_NODE_LIST
#define OGDF_NODE_LIST
Definition: Graph_d.h:132
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:551
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 dynamic library (shared object / DLL),...
Definition: config.h:117
ogdf::Graph::HiddenEdgeSet::m_graph
Graph * m_graph
Definition: Graph_d.h:1285
ogdf::internal::EdgeArrayBase1
RegisteredArray for edges of a graph.
Definition: Graph_d.h:677
ogdf::EdgeElement::compare
static int compare(const EdgeElement &x, const EdgeElement &y)
Standard Comparer.
Definition: Graph_d.h:465
ogdf::Graph::newNode
node newNode(int index=-1)
Creates a new node and returns it.
Definition: Graph_d.h:1061
ogdf::NodeElement::firstAdj
adjEntry firstAdj() const
Returns the first entry in the adjaceny list.
Definition: Graph_d.h:287
ogdf::NodeElement::succ
node succ() const
Returns the successor in the list of all nodes.
Definition: Graph_d.h:293
ogdf::AdjElement::faceCycleSucc
adjEntry faceCycleSucc() const
Returns the cyclic successor in face.
Definition: Graph_d.h:213
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:369
ogdf::Graph::m_regNodeArrays
internal::GraphNodeRegistry m_regNodeArrays
The registered node arrays.
Definition: Graph_d.h:877
ogdf::EdgeElement::opposite
node opposite(node v) const
Returns the adjacent node different from v.
Definition: Graph_d.h:414
ogdf::Graph::CCsInfo::startNode
int startNode(int cc) const
Returns the index of the first node in connected component cc.
Definition: Graph_d.h:1925
OGDF_EDGE_LIST
#define OGDF_EDGE_LIST
Definition: Graph_d.h:133
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:364
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:694
ogdf::Graph::moveAdj
void moveAdj(adjEntry adjMove, Direction dir, adjEntry adjPos)
Moves adjacency entry adjMove before or after adjPos.
Definition: Graph_d.h:1528
ogdf::Graph::CCsInfo::m_graph
const Graph * m_graph
points to the associated graph.
Definition: Graph_d.h:1897
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:434
ogdf::NodeElement::graphOf
const Graph * graphOf() const
Returns the graph containing this node (debug only).
Definition: Graph_d.h:345
ogdf::Graph::CCsInfo::m_nodes
Array< node > m_nodes
array of all nodes.
Definition: Graph_d.h:1900
ogdf::Graph::CCsInfo::m_edges
Array< edge > m_edges
array of all edges.
Definition: Graph_d.h:1901
ogdf::AdjElement::AdjElement
AdjElement(edge e, int id)
Constructs an adjacency entry for a given edge and index.
Definition: Graph_d.h:157
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:910
ogdf::EdgeElement::isIncident
bool isIncident(node v) const
Returns true iff v is incident to the edge.
Definition: Graph_d.h:445
ogdf::AdjElement::m_node
node m_node
The node whose adjacency list contains this entry.
Definition: Graph_d.h:150
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:1099
ogdf::Graph::maxAdjEntryIndex
int maxAdjEntryIndex() const
Returns the largest used adjEntry index.
Definition: Graph_d.h:991
ogdf::AdjElement::counterClockwiseFacePred
adjEntry counterClockwiseFacePred() const
Returns the counter-clockwise predecessor in face.
Definition: Graph_d.h:209
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:1771
ogdf::EdgeElement::EdgeElement
EdgeElement(node src, node tgt, AdjElement *adjSrc, AdjElement *adjTgt, int id)
Constructs an edge element (src,tgt).
Definition: Graph_d.h:382
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:179
ogdf::internal::GraphRegistry::maxKeyIndex
int maxKeyIndex() const
Definition: Graph_d.h:632
ogdf::NodeElement::outEdges
void outEdges(EDGELIST &edgeList) const
Returns a list with all outgoing edges of this node.
Definition: Graph_d.h:513
ogdf::internal::GraphRegistry::iterator
typename Iterable::iterator iterator
Definition: Graph_d.h:604
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:294
ogdf::Graph::edgeInserted
virtual void edgeInserted(void *userData, edge original, edge copy)
Callback notifying subclasses that insert() copied an edge.
Definition: Graph_d.h:1882
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:701
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:405
ogdf::EdgeElement::target
node target() const
Returns the target node of the edge.
Definition: Graph_d.h:402
ogdf::Graph::CCsInfo::numberOfCCs
int numberOfCCs() const
Returns the number of connected components.
Definition: Graph_d.h:1916
ogdf::GraphAdjIterator::operator++
GraphAdjIterator & operator++()
Increment operator (prefix).
Definition: Graph_d.h:562
ogdf::NodeElement::m_id
int m_id
The (unique) index of the node.
Definition: Graph_d.h:248
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:1080
ogdf::EdgeElement::m_id
int m_id
Definition: Graph_d.h:372
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:598
comparer.h
Declarations for Comparer objects.
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:241
ogdf::Graph::m_regAdjArrays
internal::GraphAdjRegistry m_regAdjArrays
The registered adjEntry arrays.
Definition: Graph_d.h:879
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:451
ogdf::GraphAdjIterator::operator*
adjEntry operator*() const
Returns the associated adjEntry.
Definition: Graph_d.h:548
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:448
ogdf::internal::GraphRegistry::calculateArraySize
int calculateArraySize(int add) const
Definition: Graph_d.h:628
ogdf::Graph::CCsInfo::startEdge
int startEdge(int cc) const
Returns the index of the first edge in connected component cc.
Definition: Graph_d.h:1939
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:1450
ogdf::NodeElement::NodeElement
NodeElement(const Graph *pGraph, int id)
Constructs a node element with index id.
Definition: Graph_d.h:263
ogdf::internal::EdgeArrayBase2
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
Definition: Graph_d.h:717
ogdf::RegistryBase::reserveSpace
void reserveSpace(int new_keys)
Resizes all arrays to make space of new_keys new keys.
Definition: RegisteredArray.h:249