Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

PivotMDS.h
Go to the documentation of this file.
1 
35 #pragma once
36 
40 
41 
42 namespace ogdf {
43 
44 
45 template<typename T>
46 inline bool isinf(T value)
47 {
48  return std::numeric_limits<T>::has_infinity &&
49  value == std::numeric_limits<T>::infinity();
50 }
51 
52 
54 
58 public:
59  PivotMDS() : m_numberOfPivots(250), m_edgeCosts(100), m_hasEdgeCostsAttribute(false) { }
60 
61  virtual ~PivotMDS() { }
62 
65  void setNumberOfPivots(int numberOfPivots) {
66  m_numberOfPivots = (numberOfPivots < DIMENSION_COUNT) ? DIMENSION_COUNT : numberOfPivots;
67  }
68 
71  void setEdgeCosts(double edgeCosts){
72  m_edgeCosts = edgeCosts;
73  }
74 
76  virtual void call(GraphAttributes& GA) override;
77 
78 
79  void useEdgeCostsAttribute(bool useEdgeCostsAttribute) {
80  m_hasEdgeCostsAttribute = useEdgeCostsAttribute;
81  }
82 
83  bool useEdgeCostsAttribute() const {
84  return m_hasEdgeCostsAttribute;
85  }
86 
87 private:
88 
92  const static int DIMENSION_COUNT = 2;
93 
95  const static double EPSILON;
96 
98  const static double FACTOR;
99 
101  const static unsigned int SEED = 0;
102 
105 
107  double m_edgeCosts;
108 
112 
114  void centerPivotmatrix(Array<Array<double> >& pivotMatrix);
115 
117  void pivotMDSLayout(GraphAttributes& GA);
118 
119  void copySPSS(Array<double>& copyTo, NodeArray<double>& copyFrom);
120 
122  void doPathLayout(GraphAttributes& GA, const node& v);
123 
125  void eigenValueDecomposition(
126  Array<Array<double> >& K,
127  Array<Array<double> >& eVecs,
128  Array<double>& eValues);
129 
131  void getPivotDistanceMatrix(const GraphAttributes& GA, Array<Array<double> >& pivDistMatrix);
132 
134  node getRootedPath(const Graph& G);
135 
137  double normalize(Array<double>& x);
138 
140  double prod(const Array<double>& x, const Array<double>& y);
141 
143  void randomize(Array<Array<double> >& matrix);
144 
146  void selfProduct(const Array<Array<double> >&d, Array<Array<double> >& result);
147 
149  void singularValueDecomposition(
150  Array<Array<double> >& K,
151  Array<Array<double> >& eVecs,
152  Array<double>& eVals);
153 };
154 
155 
156 } // end namespace ogdf
bool m_hasEdgeCostsAttribute
Tells whether the pivot mds is based on uniform edge costs or a edge costs attribute.
Definition: PivotMDS.h:111
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:56
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
#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:79
Declaration of several shortest path algorithms.
int m_numberOfPivots
The number of pivots.
Definition: PivotMDS.h:104
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
double m_edgeCosts
The costs to traverse an edge.
Definition: PivotMDS.h:107
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:71
Declaration of interface for layout algorithms (class LayoutModule)
Class for the representation of nodes.
Definition: Graph_d.h:167
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:46
bool useEdgeCostsAttribute() const
Definition: PivotMDS.h:83
static const double FACTOR
Factor used to center the pivot matrix.
Definition: PivotMDS.h:98
virtual ~PivotMDS()
Definition: PivotMDS.h:61
The Pivot MDS (multi-dimensional scaling) layout algorithm.
Definition: PivotMDS.h:57
static const double EPSILON
Convergence factor used for power iteration.
Definition: PivotMDS.h:95