Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

MinimumEdgeDistances.h
Go to the documentation of this file.
1 
34 #pragma once
35 
36 #include <ogdf/basic/Graph.h>
37 #include <ogdf/basic/basic.h>
38 
39 namespace ogdf {
40 enum class OrthoDir;
41 
43 template<class ATYPE>
44 class MinimumEdgeDistances {
45 public:
46  // constructor
47  MinimumEdgeDistances(const Graph& G, ATYPE sep) : m_delta(G), m_epsilon(G) { m_sep = sep; }
48 
49  // returns delta_s(v)^i (with i = 0 => l, i = 1 => r)
50  const ATYPE& delta(node v, OrthoDir s, int i) const {
51  OGDF_ASSERT(0 <= int(s));
52  OGDF_ASSERT(int(s) <= 3);
53  OGDF_ASSERT(0 <= i);
54  OGDF_ASSERT(i <= 1);
55  return m_delta[v].info[static_cast<int>(s)][i];
56  }
57 
58  ATYPE& delta(node v, OrthoDir s, int i) {
59  OGDF_ASSERT(0 <= int(s));
60  OGDF_ASSERT(int(s) <= 3);
61  OGDF_ASSERT(0 <= i);
62  OGDF_ASSERT(i <= 1);
63  return m_delta[v].info[static_cast<int>(s)][i];
64  }
65 
66  // returns epsilon_s(v)^i (with i = 0 => l, i = 1 => r)
67  const ATYPE& epsilon(node v, OrthoDir s, int i) const {
68  OGDF_ASSERT(0 <= int(s));
69  OGDF_ASSERT(int(s) <= 3);
70  OGDF_ASSERT(0 <= i);
71  OGDF_ASSERT(i <= 1);
72  return m_epsilon[v].info[static_cast<int>(s)][i];
73  }
74 
75  ATYPE& epsilon(node v, OrthoDir s, int i) {
76  OGDF_ASSERT(0 <= int(s));
77  OGDF_ASSERT(int(s) <= 3);
78  OGDF_ASSERT(0 <= i);
79  OGDF_ASSERT(i <= 1);
80  return m_epsilon[v].info[static_cast<int>(s)][i];
81  }
82 
83  ATYPE separation() const { return m_sep; }
84 
85  void separation(ATYPE sep) { m_sep = sep; }
86 
87 
88 private:
89  struct InfoType {
90  ATYPE info[4][2];
91  };
92 
95  ATYPE m_sep;
96 };
97 
98 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
Graph.h
Includes declaration of graph class.
ogdf::MinimumEdgeDistances::epsilon
ATYPE & epsilon(node v, OrthoDir s, int i)
Definition: MinimumEdgeDistances.h:75
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
ogdf::OrthoDir
OrthoDir
Definition: OrthoRep.h:56
ogdf::MinimumEdgeDistances::separation
ATYPE separation() const
Definition: MinimumEdgeDistances.h:83
ogdf::MinimumEdgeDistances::epsilon
const ATYPE & epsilon(node v, OrthoDir s, int i) const
Definition: MinimumEdgeDistances.h:67
ogdf::MinimumEdgeDistances::delta
ATYPE & delta(node v, OrthoDir s, int i)
Definition: MinimumEdgeDistances.h:58
ogdf::MinimumEdgeDistances::m_delta
NodeArray< InfoType > m_delta
Definition: MinimumEdgeDistances.h:93
ogdf::MinimumEdgeDistances::separation
void separation(ATYPE sep)
Definition: MinimumEdgeDistances.h:85
ogdf::MinimumEdgeDistances::m_epsilon
NodeArray< InfoType > m_epsilon
Definition: MinimumEdgeDistances.h:94
ogdf::MinimumEdgeDistances::MinimumEdgeDistances
MinimumEdgeDistances(const Graph &G, ATYPE sep)
Definition: MinimumEdgeDistances.h:47
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::MinimumEdgeDistances::InfoType::info
ATYPE info[4][2]
Definition: MinimumEdgeDistances.h:90
basic.h
Basic declarations, included by all source files.
ogdf::MinimumEdgeDistances::delta
const ATYPE & delta(node v, OrthoDir s, int i) const
Definition: MinimumEdgeDistances.h:50
ogdf::MinimumEdgeDistances::InfoType
Definition: MinimumEdgeDistances.h:89
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::MinimumEdgeDistances::m_sep
ATYPE m_sep
Definition: MinimumEdgeDistances.h:95