Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

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 {
46  return std::numeric_limits<T>::has_infinity &&
47  value == std::numeric_limits<T>::infinity();
48 }
49 
50 
52 
56 public:
57  PivotMDS() : m_numberOfPivots(250), m_edgeCosts(100), m_hasEdgeCostsAttribute(false) { }
58 
59  virtual ~PivotMDS() { }
60 
63  void setNumberOfPivots(int numberOfPivots) {
64  m_numberOfPivots = (numberOfPivots < DIMENSION_COUNT) ? DIMENSION_COUNT : numberOfPivots;
65  }
66 
69  void setEdgeCosts(double edgeCosts){
70  m_edgeCosts = edgeCosts;
71  }
72 
74  virtual void call(GraphAttributes& GA) override;
75 
76 
77  void useEdgeCostsAttribute(bool useEdgeCostsAttribute) {
78  m_hasEdgeCostsAttribute = useEdgeCostsAttribute;
79  }
80 
81  bool useEdgeCostsAttribute() const {
82  return m_hasEdgeCostsAttribute;
83  }
84 
85 private:
86 
90  const static int DIMENSION_COUNT = 2;
91 
93  const static double EPSILON;
94 
96  const static double FACTOR;
97 
99  const static unsigned int SEED = 0;
100 
103 
105  double m_edgeCosts;
106 
110 
112  void centerPivotmatrix(Array<Array<double> >& pivotMatrix);
113 
115  void pivotMDSLayout(GraphAttributes& GA);
116 
117  void copySPSS(Array<double>& copyTo, NodeArray<double>& copyFrom);
118 
120  void doPathLayout(GraphAttributes& GA, const node& v);
121 
123  void eigenValueDecomposition(
124  Array<Array<double> >& K,
125  Array<Array<double> >& eVecs,
126  Array<double>& eValues);
127 
129  void getPivotDistanceMatrix(const GraphAttributes& GA, Array<Array<double> >& pivDistMatrix);
130 
132  node getRootedPath(const Graph& G);
133 
135  double normalize(Array<double>& x);
136 
138  double prod(const Array<double>& x, const Array<double>& y);
139 
141  void randomize(Array<Array<double> >& matrix);
142 
144  void selfProduct(const Array<Array<double> >&d, Array<Array<double> >& result);
145 
147  void singularValueDecomposition(
148  Array<Array<double> >& K,
149  Array<Array<double> >& eVecs,
150  Array<double>& eVals);
151 };
152 
153 }
bool m_hasEdgeCostsAttribute
Tells whether the pivot mds is based on uniform edge costs or a edge costs attribute.
Definition: PivotMDS.h:109
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:200
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:492
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
void useEdgeCostsAttribute(bool useEdgeCostsAttribute)
Definition: PivotMDS.h:77
Declaration of several shortest path algorithms.
int m_numberOfPivots
The number of pivots.
Definition: PivotMDS.h:102
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:63
double m_edgeCosts
The costs to traverse an edge.
Definition: PivotMDS.h:105
Stores additional attributes of a graph (like layout information).
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:69
Declaration of interface for layout algorithms (class LayoutModule)
Class for the representation of nodes.
Definition: Graph_d.h:169
Interface of general layout algorithms.
Definition: LayoutModule.h:44
Declaration of simple graph algorithms.
The namespace for all OGDF objects.
bool isinf(T value)
Definition: PivotMDS.h:44
bool useEdgeCostsAttribute() const
Definition: PivotMDS.h:81
static const double FACTOR
Factor used to center the pivot matrix.
Definition: PivotMDS.h:96
virtual ~PivotMDS()
Definition: PivotMDS.h:59
The Pivot MDS (multi-dimensional scaling) layout algorithm.
Definition: PivotMDS.h:55
static const double EPSILON
Convergence factor used for power iteration.
Definition: PivotMDS.h:93