Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

PivotMDS.h
Go to the documentation of this file.
1 
35 #pragma once
36 
40 
41 namespace ogdf {
42 
43 template<typename T>
44 inline bool isinf(T value) {
45  return std::numeric_limits<T>::has_infinity && value == std::numeric_limits<T>::infinity();
46 }
47 
49 
53 public:
55  : m_numberOfPivots(250)
56  , m_dimensionCount(2)
57  , m_edgeCosts(100)
58  , m_hasEdgeCostsAttribute(false)
59  , m_forcing2DLayout(false) { }
60 
61  virtual ~PivotMDS() { }
62 
65  void setNumberOfPivots(int numberOfPivots) {
66  m_numberOfPivots = std::max(numberOfPivots, m_dimensionCount);
67  }
68 
71  void setEdgeCosts(double edgeCosts) { m_edgeCosts = edgeCosts; }
72 
75  void setForcing2DLayout(bool forcing2DLayout) { m_forcing2DLayout = forcing2DLayout; }
76 
79  bool isForcing2DLayout() const { return m_forcing2DLayout; }
80 
82 
88  virtual void call(GraphAttributes& GA) override;
89 
90  void useEdgeCostsAttribute(bool useEdgeCostsAttribute) {
91  m_hasEdgeCostsAttribute = useEdgeCostsAttribute;
92  }
93 
94  bool useEdgeCostsAttribute() const { return m_hasEdgeCostsAttribute; }
95 
96 private:
98  const static double EPSILON;
99 
101  const static double FACTOR;
102 
104  const static unsigned int SEED = 0;
105 
108 
113 
115  double m_edgeCosts;
116 
120 
124 
126  void centerPivotmatrix(Array<Array<double>>& pivotMatrix);
127 
129  void pivotMDSLayout(GraphAttributes& GA);
130 
131  void copySPSS(Array<double>& copyTo, NodeArray<double>& copyFrom);
132 
134  void doPathLayout(GraphAttributes& GA, const node& v);
135 
137  void eigenValueDecomposition(Array<Array<double>>& K, Array<Array<double>>& eVecs,
138  Array<double>& eValues);
139 
141  void getPivotDistanceMatrix(const GraphAttributes& GA, Array<Array<double>>& pivDistMatrix);
142 
144  node getRootedPath(const Graph& G);
145 
147  double normalize(Array<double>& x);
148 
150  double prod(const Array<double>& x, const Array<double>& y);
151 
153  void randomize(Array<Array<double>>& matrix);
154 
156  void selfProduct(const Array<Array<double>>& d, Array<Array<double>>& result);
157 
159  void singularValueDecomposition(Array<Array<double>>& K, Array<Array<double>>& eVecs,
160  Array<double>& eVals);
161 };
162 
163 }
ogdf::PivotMDS::m_edgeCosts
double m_edgeCosts
The costs to traverse an edge.
Definition: PivotMDS.h:115
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
ogdf::PivotMDS::m_numberOfPivots
int m_numberOfPivots
The number of pivots.
Definition: PivotMDS.h:107
ogdf::PivotMDS::setEdgeCosts
void setEdgeCosts(double edgeCosts)
Sets the desired distance between adjacent nodes. If the new value is smaller or equal 0 the default ...
Definition: PivotMDS.h:71
ogdf::matching_blossom::infinity
TWeight infinity()
Helper function to get the maximum value for a given weight type.
Definition: utils.h:43
ogdf::PivotMDS::PivotMDS
PivotMDS()
Definition: PivotMDS.h:54
ogdf::PivotMDS::m_dimensionCount
int m_dimensionCount
The dimension count determines the number of evecs that will be computed. Nevertheless PivotMDS only ...
Definition: PivotMDS.h:112
ogdf::PivotMDS::setNumberOfPivots
void setNumberOfPivots(int numberOfPivots)
Sets the number of pivots. If the new value is smaller or equal 0 the default value (250) is used.
Definition: PivotMDS.h:65
ogdf::PivotMDS::m_hasEdgeCostsAttribute
bool m_hasEdgeCostsAttribute
Tells whether the pivot mds is based on uniform edge costs or a edge costs attribute.
Definition: PivotMDS.h:119
ogdf::PivotMDS::useEdgeCostsAttribute
bool useEdgeCostsAttribute() const
Definition: PivotMDS.h:94
LayoutModule.h
Declaration of interface for layout algorithms (class LayoutModule)
ogdf::PivotMDS::m_forcing2DLayout
bool m_forcing2DLayout
Whether a 2D-layout is calculated even when GraphAttributes::threeD is set.
Definition: PivotMDS.h:123
ogdf::PivotMDS
The Pivot MDS (multi-dimensional scaling) layout algorithm.
Definition: PivotMDS.h:52
ogdf::PivotMDS::~PivotMDS
virtual ~PivotMDS()
Definition: PivotMDS.h:61
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:214
ogdf::isinf
bool isinf(T value)
Definition: PivotMDS.h:44
ogdf::PivotMDS::setForcing2DLayout
void setForcing2DLayout(bool forcing2DLayout)
Sets whether a 2D-layout should be calculated even when GraphAttributes::threeD is set.
Definition: PivotMDS.h:75
ogdf::PivotMDS::EPSILON
const static double EPSILON
Convergence factor used for power iteration.
Definition: PivotMDS.h:98
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::PivotMDS::isForcing2DLayout
bool isForcing2DLayout() const
Returns whether a 2D-layout is calculated even when GraphAttributes::threeD is set.
Definition: PivotMDS.h:79
ogdf::PivotMDS::useEdgeCostsAttribute
void useEdgeCostsAttribute(bool useEdgeCostsAttribute)
Definition: PivotMDS.h:90
ShortestPathAlgorithms.h
Declaration of several shortest path algorithms.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::PivotMDS::FACTOR
const static double FACTOR
Factor used to center the pivot matrix.
Definition: PivotMDS.h:101
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
simple_graph_alg.h
Declaration of simple graph algorithms.
ogdf::LayoutModule
Interface of general layout algorithms.
Definition: LayoutModule.h:44