Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
PivotMDS.h
Go to the documentation of this file.
1
35#pragma once
36
40
41namespace ogdf {
42
43template<typename T>
44inline bool isinf(T value) {
45 return std::numeric_limits<T>::has_infinity && value == std::numeric_limits<T>::infinity();
46}
47
49
53public:
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
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
96private:
98 const static double EPSILON;
99
101 const static double FACTOR;
102
104 const static unsigned int SEED = 0;
105
108
113
116
120
124
127
130
132
135
139
142
145
148
150 double prod(const Array<double>& x, const Array<double>& y);
151
154
157
161};
162
163}
Declaration of interface for layout algorithms (class LayoutModule)
Declaration of several shortest path algorithms.
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Interface of general layout algorithms.
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
The Pivot MDS (multi-dimensional scaling) layout algorithm.
Definition PivotMDS.h:52
void copySPSS(Array< double > &copyTo, NodeArray< double > &copyFrom)
virtual ~PivotMDS()
Definition PivotMDS.h:61
void doPathLayout(GraphAttributes &GA, const node &v)
Computes the layout of a path.
double normalize(Array< double > &x)
Normalizes the vector x.
virtual void call(GraphAttributes &GA) override
Calls the layout algorithm for graph attributes GA.
bool isForcing2DLayout() const
Returns whether a 2D-layout is calculated even when GraphAttributes::threeD is set.
Definition PivotMDS.h:79
void pivotMDSLayout(GraphAttributes &GA)
Computes the pivot mds layout of the given connected graph of GA.
void eigenValueDecomposition(Array< Array< double > > &K, Array< Array< double > > &eVecs, Array< double > &eValues)
Computes the eigen value decomposition based on power iteration.
double prod(const Array< double > &x, const Array< double > &y)
Computes the product of two vectors x and y.
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
int m_numberOfPivots
The number of pivots.
Definition PivotMDS.h:107
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
static const double FACTOR
Factor used to center the pivot matrix.
Definition PivotMDS.h:101
bool m_forcing2DLayout
Whether a 2D-layout is calculated even when GraphAttributes::threeD is set.
Definition PivotMDS.h:123
bool m_hasEdgeCostsAttribute
Tells whether the pivot mds is based on uniform edge costs or a edge costs attribute.
Definition PivotMDS.h:119
void useEdgeCostsAttribute(bool useEdgeCostsAttribute)
Definition PivotMDS.h:90
void getPivotDistanceMatrix(const GraphAttributes &GA, Array< Array< double > > &pivDistMatrix)
Computes the pivot distance matrix based on the maxmin strategy.
double m_edgeCosts
The costs to traverse an edge.
Definition PivotMDS.h:115
void selfProduct(const Array< Array< double > > &d, Array< Array< double > > &result)
Computes the self product of d.
node getRootedPath(const Graph &G)
Checks whether the given graph is a path or not.
void setForcing2DLayout(bool forcing2DLayout)
Sets whether a 2D-layout should be calculated even when GraphAttributes::threeD is set.
Definition PivotMDS.h:75
void singularValueDecomposition(Array< Array< double > > &K, Array< Array< double > > &eVecs, Array< double > &eVals)
Computes the singular value decomposition of matrix K.
int m_dimensionCount
The dimension count determines the number of evecs that will be computed. Nevertheless PivotMDS only ...
Definition PivotMDS.h:112
void centerPivotmatrix(Array< Array< double > > &pivotMatrix)
Centers the pivot matrix.
void randomize(Array< Array< double > > &matrix)
Fills the given matrix with random doubles d 0 <= d <= 1.
static const double EPSILON
Convergence factor used for power iteration.
Definition PivotMDS.h:98
bool useEdgeCostsAttribute() const
Definition PivotMDS.h:94
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
bool isinf(T value)
Definition PivotMDS.h:44
Declaration of simple graph algorithms.