The energy-based GEM layout algorithm. More...
#include <ogdf/energybased/GEMLayout.h>
Public Member Functions | |
GEMLayout () | |
Creates an instance of GEM layout. More... | |
GEMLayout (const GEMLayout &fl) | |
Copy constructor. More... | |
~GEMLayout () | |
int | attractionFormula () const |
Returns the used formula for attraction (1 = Fruchterman / Reingold, 2 = GEM). More... | |
void | attractionFormula (int n) |
sets the formula for attraction to n (1 = Fruchterman / Reingold, 2 = GEM). More... | |
virtual void | call (GraphAttributes &GA) override |
Calls the layout algorithm for graph attributes GA . More... | |
double | desiredLength () const |
Returns the desired edge length. More... | |
void | desiredLength (double x) |
Sets the desired edge length to x ; must be >= 0. More... | |
double | gravitationalConstant () const |
Returns the gravitational constant. More... | |
void | gravitationalConstant (double x) |
Sets the gravitational constant to x ; must be >= 0. Attention! Only (very) small values give acceptable results. More... | |
double | initialTemperature () const |
Returns the initial temperature. More... | |
void | initialTemperature (double x) |
Sets the initial temperature to x ; must be >= minimalTemperature. More... | |
double | maximalDisturbance () const |
Returns the maximal disturbance. More... | |
void | maximalDisturbance (double x) |
Sets the maximal disturbance to x ; must be >= 0. More... | |
double | minDistCC () const |
Returns the minimal distance between connected components. More... | |
void | minDistCC (double x) |
Sets the minimal distance between connected components to x . More... | |
double | minimalTemperature () const |
Returns the minimal temperature. More... | |
void | minimalTemperature (double x) |
Sets the minimal temperature to x . More... | |
int | numberOfRounds () const |
Returns the maximal number of rounds per node. More... | |
void | numberOfRounds (int n) |
Sets the maximal number of round per node to n . More... | |
GEMLayout & | operator= (const GEMLayout &fl) |
Assignment operator. More... | |
double | oscillationAngle () const |
Returns the opening angle for oscillations. More... | |
void | oscillationAngle (double x) |
Sets the opening angle for oscillations to x (0 <= x <= pi / 2). More... | |
double | oscillationSensitivity () const |
Returns the oscillation sensitivity. More... | |
void | oscillationSensitivity (double x) |
Sets the oscillation sensitivity to x (0 <= x <= 1). More... | |
double | pageRatio () const |
Returns the page ratio used for the layout of connected components. More... | |
void | pageRatio (double x) |
Sets the page ratio used for the layout of connected components to x . More... | |
double | rotationAngle () const |
Returns the opening angle for rotations. More... | |
void | rotationAngle (double x) |
Sets the opening angle for rotations to x (0 <= x <= pi / 2). More... | |
double | rotationSensitivity () const |
Returns the rotation sensitivity. More... | |
void | rotationSensitivity (double x) |
Sets the rotation sensitivity to x (0 <= x <= 1). More... | |
Public Member Functions inherited from ogdf::LayoutModule | |
LayoutModule () | |
Initializes a layout module. More... | |
virtual | ~LayoutModule () |
void | operator() (GraphAttributes &GA) |
Computes a layout of graph GA . More... | |
Private Member Functions | |
void | computeImpulse (GraphCopy &GC, GraphAttributes &AGC, node v) |
Computes the new impulse for node v . More... | |
double | length (double x, double y=0) const |
Returns the length of the vector (x ,y ). More... | |
void | updateNode (GraphCopy &GC, GraphAttributes &AGC, node v) |
Updates the node data for node v . More... | |
double | weight (node v) const |
Returns the weight of node v according to its degree. More... | |
Private Attributes | |
int | m_attractionFormula |
The used formula for attraction. More... | |
double | m_barycenterX |
Weighted sum of x-coordinates of all nodes. More... | |
double | m_barycenterY |
Weighted sum of y-coordinates of all nodes. More... | |
double | m_cos |
Cosine of m_oscillationAngle / 2. More... | |
double | m_desiredLength |
The desired edge length. More... | |
double | m_globalTemperature |
Average of all node temperatures. More... | |
double | m_gravitationalConstant |
The gravitational constant. More... | |
NodeArray< double > | m_impulseX |
x-coordinate of the last impulse of the node More... | |
NodeArray< double > | m_impulseY |
y-coordinate of the last impulse of the node More... | |
double | m_initialTemperature |
The initial temperature. More... | |
NodeArray< double > | m_localTemperature |
local temperature of the node More... | |
double | m_maximalDisturbance |
The maximal disturbance. More... | |
double | m_minDistCC |
The minimal distance between connected components. More... | |
double | m_minimalTemperature |
The minimal temperature. More... | |
double | m_newImpulseX |
x-coordinate of the new impulse of the current node. More... | |
double | m_newImpulseY |
y-coordinate of the new impulse of the current node. More... | |
int | m_numberOfRounds |
The maximal number of rounds per node. More... | |
double | m_oscillationAngle |
The opening angle for oscillations. More... | |
double | m_oscillationSensitivity |
The oscillation sensitivity. More... | |
double | m_pageRatio |
The page ratio used for the layout of connected components. More... | |
std::minstd_rand | m_rng |
double | m_rotationAngle |
The opening angle for rotations. More... | |
double | m_rotationSensitivity |
The rotation sensitivity. More... | |
double | m_sin |
Sine of (pi + m_rotationAngle) / 2. More... | |
NodeArray< double > | m_skewGauge |
skew gauge of the node More... | |
The energy-based GEM layout algorithm.
The implementation used in GEMLayout is based on the following publication:
Arne Frick, Andreas Ludwig, Heiko Mehldau: A Fast Adaptive Layout Algorithm for Undirected Graphs. Proc. Graph Drawing 1994, LNCS 894, pp. 388-403, 1995.
GEM layout provides the following optional parameters.
Option | Type | Default | Description |
---|---|---|---|
numberOfRounds | int | 20000 | The maximal number of rounds per node. |
minimalTemperature | double | 0.005 | The minimal temperature. |
initialTemperature | double | 10.0 | The initial temperature. |
gravitationalConstant | double | 1/16 | The gravitational constant. |
desiredLength | double | 5.0 | The desired edge length. |
maximalDisturbance | double | 0 | The maximal disturbance. |
rotationAngle | double | pi/3.0 | The opening angle for rotations. |
oscillationAngle | double | pi/2.0 | The opening angle for oscillations. |
rotationSensitivity | double | 0.01 | The rotation sensitivity. |
oscillationSensitivity | double | 0.3 | The oscillation sensitivity. |
attractionFormula | int | 1 | The used formula for attraction (1 = Fruchterman / Reingold, 2 = GEM). |
minDistCC | double | 20 | The minimal distance between connected components. |
pageRatio | double | 1.0 | The page ratio used for the layout of connected components. |
Definition at line 108 of file GEMLayout.h.
ogdf::GEMLayout::GEMLayout | ( | ) |
Creates an instance of GEM layout.
ogdf::GEMLayout::GEMLayout | ( | const GEMLayout & | fl | ) |
Copy constructor.
ogdf::GEMLayout::~GEMLayout | ( | ) |
|
inline |
Returns the used formula for attraction (1 = Fruchterman / Reingold, 2 = GEM).
Definition at line 256 of file GEMLayout.h.
|
inline |
sets the formula for attraction to n
(1 = Fruchterman / Reingold, 2 = GEM).
Definition at line 259 of file GEMLayout.h.
|
overridevirtual |
Calls the layout algorithm for graph attributes GA
.
Implements ogdf::LayoutModule.
|
private |
Computes the new impulse for node v
.
|
inline |
Returns the desired edge length.
Definition at line 188 of file GEMLayout.h.
|
inline |
Sets the desired edge length to x
; must be >= 0.
Definition at line 191 of file GEMLayout.h.
|
inline |
Returns the gravitational constant.
Definition at line 181 of file GEMLayout.h.
|
inline |
Sets the gravitational constant to x
; must be >= 0. Attention! Only (very) small values give acceptable results.
Definition at line 185 of file GEMLayout.h.
|
inline |
Returns the initial temperature.
Definition at line 173 of file GEMLayout.h.
|
inline |
Sets the initial temperature to x
; must be >= minimalTemperature.
Definition at line 176 of file GEMLayout.h.
|
inlineprivate |
Returns the length of the vector (x
,y
).
Definition at line 280 of file GEMLayout.h.
|
inline |
Returns the maximal disturbance.
Definition at line 194 of file GEMLayout.h.
|
inline |
Sets the maximal disturbance to x
; must be >= 0.
Definition at line 197 of file GEMLayout.h.
|
inline |
Returns the minimal distance between connected components.
Definition at line 266 of file GEMLayout.h.
|
inline |
Sets the minimal distance between connected components to x
.
Definition at line 269 of file GEMLayout.h.
|
inline |
Returns the minimal temperature.
Definition at line 167 of file GEMLayout.h.
|
inline |
Sets the minimal temperature to x
.
Definition at line 170 of file GEMLayout.h.
|
inline |
Returns the maximal number of rounds per node.
Definition at line 161 of file GEMLayout.h.
|
inline |
Sets the maximal number of round per node to n
.
Definition at line 164 of file GEMLayout.h.
|
inline |
Returns the opening angle for oscillations.
Definition at line 214 of file GEMLayout.h.
|
inline |
Sets the opening angle for oscillations to x
(0 <= x
<= pi / 2).
Definition at line 217 of file GEMLayout.h.
|
inline |
Returns the oscillation sensitivity.
Definition at line 242 of file GEMLayout.h.
|
inline |
Sets the oscillation sensitivity to x
(0 <= x
<= 1).
Definition at line 245 of file GEMLayout.h.
|
inline |
Returns the page ratio used for the layout of connected components.
Definition at line 272 of file GEMLayout.h.
|
inline |
Sets the page ratio used for the layout of connected components to x
.
Definition at line 275 of file GEMLayout.h.
|
inline |
Returns the opening angle for rotations.
Definition at line 200 of file GEMLayout.h.
|
inline |
Sets the opening angle for rotations to x
(0 <= x
<= pi / 2).
Definition at line 203 of file GEMLayout.h.
|
inline |
Returns the rotation sensitivity.
Definition at line 228 of file GEMLayout.h.
|
inline |
Sets the rotation sensitivity to x
(0 <= x
<= 1).
Definition at line 231 of file GEMLayout.h.
|
private |
Updates the node data for node v
.
|
inlineprivate |
Returns the weight of node v
according to its degree.
Definition at line 283 of file GEMLayout.h.
|
private |
The used formula for attraction.
Definition at line 121 of file GEMLayout.h.
|
private |
Weighted sum of x-coordinates of all nodes.
Definition at line 134 of file GEMLayout.h.
|
private |
Weighted sum of y-coordinates of all nodes.
Definition at line 135 of file GEMLayout.h.
|
private |
Cosine of m_oscillationAngle / 2.
Definition at line 139 of file GEMLayout.h.
|
private |
The desired edge length.
Definition at line 115 of file GEMLayout.h.
|
private |
Average of all node temperatures.
Definition at line 138 of file GEMLayout.h.
|
private |
The gravitational constant.
Definition at line 114 of file GEMLayout.h.
|
private |
x-coordinate of the last impulse of the node
Definition at line 127 of file GEMLayout.h.
|
private |
y-coordinate of the last impulse of the node
Definition at line 128 of file GEMLayout.h.
|
private |
The initial temperature.
Definition at line 113 of file GEMLayout.h.
|
private |
local temperature of the node
Definition at line 129 of file GEMLayout.h.
|
private |
The maximal disturbance.
Definition at line 116 of file GEMLayout.h.
|
private |
The minimal distance between connected components.
Definition at line 122 of file GEMLayout.h.
|
private |
The minimal temperature.
Definition at line 112 of file GEMLayout.h.
|
private |
x-coordinate of the new impulse of the current node.
Definition at line 136 of file GEMLayout.h.
|
private |
y-coordinate of the new impulse of the current node.
Definition at line 137 of file GEMLayout.h.
|
private |
The maximal number of rounds per node.
Definition at line 111 of file GEMLayout.h.
|
private |
The opening angle for oscillations.
Definition at line 118 of file GEMLayout.h.
|
private |
The oscillation sensitivity.
Definition at line 120 of file GEMLayout.h.
|
private |
The page ratio used for the layout of connected components.
Definition at line 123 of file GEMLayout.h.
|
private |
Definition at line 142 of file GEMLayout.h.
|
private |
The opening angle for rotations.
Definition at line 117 of file GEMLayout.h.
|
private |
The rotation sensitivity.
Definition at line 119 of file GEMLayout.h.
|
private |
Sine of (pi + m_rotationAngle) / 2.
Definition at line 140 of file GEMLayout.h.
|
private |
skew gauge of the node
Definition at line 130 of file GEMLayout.h.