The energy-based GEM layout algorithm. More...
#include <ogdf/energybased/GEMLayout.h>
Inheritance diagram for ogdf::GEMLayout:Public Member Functions | |
| GEMLayout () | |
| Creates an instance of GEM layout. | |
| GEMLayout (const GEMLayout &fl) | |
| Copy constructor. | |
| ~GEMLayout () | |
| int | attractionFormula () const |
| Returns the used formula for attraction (1 = Fruchterman / Reingold, 2 = GEM). | |
| void | attractionFormula (int n) |
sets the formula for attraction to n (1 = Fruchterman / Reingold, 2 = GEM). | |
| virtual void | call (GraphAttributes &GA) override |
Calls the layout algorithm for graph attributes GA. | |
| double | desiredLength () const |
| Returns the desired edge length. | |
| void | desiredLength (double x) |
Sets the desired edge length to x; must be >= 0. | |
| double | gravitationalConstant () const |
| Returns the gravitational constant. | |
| void | gravitationalConstant (double x) |
Sets the gravitational constant to x; must be >= 0. Attention! Only (very) small values give acceptable results. | |
| double | initialTemperature () const |
| Returns the initial temperature. | |
| void | initialTemperature (double x) |
Sets the initial temperature to x; must be >= minimalTemperature. | |
| double | maximalDisturbance () const |
| Returns the maximal disturbance. | |
| void | maximalDisturbance (double x) |
Sets the maximal disturbance to x; must be >= 0. | |
| double | minDistCC () const |
| Returns the minimal distance between connected components. | |
| void | minDistCC (double x) |
Sets the minimal distance between connected components to x. | |
| double | minimalTemperature () const |
| Returns the minimal temperature. | |
| void | minimalTemperature (double x) |
Sets the minimal temperature to x. | |
| int | numberOfRounds () const |
| Returns the maximal number of rounds per node. | |
| void | numberOfRounds (int n) |
Sets the maximal number of round per node to n. | |
| GEMLayout & | operator= (const GEMLayout &fl) |
| Assignment operator. | |
| double | oscillationAngle () const |
| Returns the opening angle for oscillations. | |
| void | oscillationAngle (double x) |
Sets the opening angle for oscillations to x (0 <= x <= pi / 2). | |
| double | oscillationSensitivity () const |
| Returns the oscillation sensitivity. | |
| void | oscillationSensitivity (double x) |
Sets the oscillation sensitivity to x (0 <= x <= 1). | |
| double | pageRatio () const |
| Returns the page ratio used for the layout of connected components. | |
| void | pageRatio (double x) |
Sets the page ratio used for the layout of connected components to x. | |
| double | rotationAngle () const |
| Returns the opening angle for rotations. | |
| void | rotationAngle (double x) |
Sets the opening angle for rotations to x (0 <= x <= pi / 2). | |
| double | rotationSensitivity () const |
| Returns the rotation sensitivity. | |
| void | rotationSensitivity (double x) |
Sets the rotation sensitivity to x (0 <= x <= 1). | |
Public Member Functions inherited from ogdf::LayoutModule | |
| LayoutModule () | |
| Initializes a layout module. | |
| virtual | ~LayoutModule () |
| void | operator() (GraphAttributes &GA) |
Computes a layout of graph GA. | |
Private Member Functions | |
| void | computeImpulse (GraphCopy &GC, GraphAttributes &AGC, node v) |
Computes the new impulse for node v. | |
| double | length (double x, double y=0) const |
Returns the length of the vector (x,y). | |
| void | updateNode (GraphCopy &GC, GraphAttributes &AGC, node v) |
Updates the node data for node v. | |
| double | weight (node v) const |
Returns the weight of node v according to its degree. | |
Private Attributes | |
| int | m_attractionFormula |
| The used formula for attraction. | |
| double | m_barycenterX |
| Weighted sum of x-coordinates of all nodes. | |
| double | m_barycenterY |
| Weighted sum of y-coordinates of all nodes. | |
| double | m_cos |
| Cosine of m_oscillationAngle / 2. | |
| double | m_desiredLength |
| The desired edge length. | |
| double | m_globalTemperature |
| Average of all node temperatures. | |
| double | m_gravitationalConstant |
| The gravitational constant. | |
| NodeArray< double > | m_impulseX |
| x-coordinate of the last impulse of the node | |
| NodeArray< double > | m_impulseY |
| y-coordinate of the last impulse of the node | |
| double | m_initialTemperature |
| The initial temperature. | |
| NodeArray< double > | m_localTemperature |
| local temperature of the node | |
| double | m_maximalDisturbance |
| The maximal disturbance. | |
| double | m_minDistCC |
| The minimal distance between connected components. | |
| double | m_minimalTemperature |
| The minimal temperature. | |
| double | m_newImpulseX |
| x-coordinate of the new impulse of the current node. | |
| double | m_newImpulseY |
| y-coordinate of the new impulse of the current node. | |
| int | m_numberOfRounds |
| The maximal number of rounds per node. | |
| double | m_oscillationAngle |
| The opening angle for oscillations. | |
| double | m_oscillationSensitivity |
| The oscillation sensitivity. | |
| double | m_pageRatio |
| The page ratio used for the layout of connected components. | |
| std::minstd_rand | m_rng |
| double | m_rotationAngle |
| The opening angle for rotations. | |
| double | m_rotationSensitivity |
| The rotation sensitivity. | |
| double | m_sin |
| Sine of (pi + m_rotationAngle) / 2. | |
| NodeArray< double > | m_skewGauge |
| skew gauge of the node | |
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 104 of file GEMLayout.h.
| ogdf::GEMLayout::GEMLayout | ( | ) |
Creates an instance of GEM layout.
| ogdf::GEMLayout::~GEMLayout | ( | ) |
|
inline |
Returns the used formula for attraction (1 = Fruchterman / Reingold, 2 = GEM).
Definition at line 252 of file GEMLayout.h.
sets the formula for attraction to n (1 = Fruchterman / Reingold, 2 = GEM).
Definition at line 255 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 184 of file GEMLayout.h.
Sets the desired edge length to x; must be >= 0.
Definition at line 187 of file GEMLayout.h.
|
inline |
Returns the gravitational constant.
Definition at line 177 of file GEMLayout.h.
Sets the gravitational constant to x; must be >= 0. Attention! Only (very) small values give acceptable results.
Definition at line 181 of file GEMLayout.h.
|
inline |
Returns the initial temperature.
Definition at line 169 of file GEMLayout.h.
Sets the initial temperature to x; must be >= minimalTemperature.
Definition at line 172 of file GEMLayout.h.
Returns the length of the vector (x,y).
Definition at line 276 of file GEMLayout.h.
|
inline |
Returns the maximal disturbance.
Definition at line 190 of file GEMLayout.h.
Sets the maximal disturbance to x; must be >= 0.
Definition at line 193 of file GEMLayout.h.
|
inline |
Returns the minimal distance between connected components.
Definition at line 262 of file GEMLayout.h.
Sets the minimal distance between connected components to x.
Definition at line 265 of file GEMLayout.h.
|
inline |
Returns the minimal temperature.
Definition at line 163 of file GEMLayout.h.
Sets the minimal temperature to x.
Definition at line 166 of file GEMLayout.h.
|
inline |
Returns the maximal number of rounds per node.
Definition at line 157 of file GEMLayout.h.
Sets the maximal number of round per node to n.
Definition at line 160 of file GEMLayout.h.
|
inline |
Returns the opening angle for oscillations.
Definition at line 210 of file GEMLayout.h.
Sets the opening angle for oscillations to x (0 <= x <= pi / 2).
Definition at line 213 of file GEMLayout.h.
|
inline |
Returns the oscillation sensitivity.
Definition at line 238 of file GEMLayout.h.
Sets the oscillation sensitivity to x (0 <= x <= 1).
Definition at line 241 of file GEMLayout.h.
|
inline |
Returns the page ratio used for the layout of connected components.
Definition at line 268 of file GEMLayout.h.
Sets the page ratio used for the layout of connected components to x.
Definition at line 271 of file GEMLayout.h.
|
inline |
Returns the opening angle for rotations.
Definition at line 196 of file GEMLayout.h.
Sets the opening angle for rotations to x (0 <= x <= pi / 2).
Definition at line 199 of file GEMLayout.h.
|
inline |
Returns the rotation sensitivity.
Definition at line 224 of file GEMLayout.h.
Sets the rotation sensitivity to x (0 <= x <= 1).
Definition at line 227 of file GEMLayout.h.
|
private |
Updates the node data for node v.
Returns the weight of node v according to its degree.
Definition at line 279 of file GEMLayout.h.
|
private |
The used formula for attraction.
Definition at line 117 of file GEMLayout.h.
|
private |
Weighted sum of x-coordinates of all nodes.
Definition at line 130 of file GEMLayout.h.
|
private |
Weighted sum of y-coordinates of all nodes.
Definition at line 131 of file GEMLayout.h.
|
private |
Cosine of m_oscillationAngle / 2.
Definition at line 135 of file GEMLayout.h.
|
private |
The desired edge length.
Definition at line 111 of file GEMLayout.h.
|
private |
Average of all node temperatures.
Definition at line 134 of file GEMLayout.h.
|
private |
The gravitational constant.
Definition at line 110 of file GEMLayout.h.
x-coordinate of the last impulse of the node
Definition at line 123 of file GEMLayout.h.
y-coordinate of the last impulse of the node
Definition at line 124 of file GEMLayout.h.
|
private |
The initial temperature.
Definition at line 109 of file GEMLayout.h.
local temperature of the node
Definition at line 125 of file GEMLayout.h.
|
private |
The maximal disturbance.
Definition at line 112 of file GEMLayout.h.
|
private |
The minimal distance between connected components.
Definition at line 118 of file GEMLayout.h.
|
private |
The minimal temperature.
Definition at line 108 of file GEMLayout.h.
|
private |
x-coordinate of the new impulse of the current node.
Definition at line 132 of file GEMLayout.h.
|
private |
y-coordinate of the new impulse of the current node.
Definition at line 133 of file GEMLayout.h.
|
private |
The maximal number of rounds per node.
Definition at line 107 of file GEMLayout.h.
|
private |
The opening angle for oscillations.
Definition at line 114 of file GEMLayout.h.
|
private |
The oscillation sensitivity.
Definition at line 116 of file GEMLayout.h.
|
private |
The page ratio used for the layout of connected components.
Definition at line 119 of file GEMLayout.h.
|
private |
Definition at line 138 of file GEMLayout.h.
|
private |
The opening angle for rotations.
Definition at line 113 of file GEMLayout.h.
|
private |
The rotation sensitivity.
Definition at line 115 of file GEMLayout.h.
|
private |
Sine of (pi + m_rotationAngle) / 2.
Definition at line 136 of file GEMLayout.h.
skew gauge of the node
Definition at line 126 of file GEMLayout.h.