Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::GEMLayout Class Reference

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. 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...
 
GEMLayoutoperator= (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...
 

Detailed Description

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.

Optional parameters

GEM layout provides the following optional parameters.

OptionTypeDefaultDescription
numberOfRoundsint20000 The maximal number of rounds per node.
minimalTemperaturedouble0.005 The minimal temperature.
initialTemperaturedouble10.0 The initial temperature.
gravitationalConstantdouble1/16 The gravitational constant.
desiredLengthdouble5.0 The desired edge length.
maximalDisturbancedouble0 The maximal disturbance.
rotationAngledoublepi/3.0 The opening angle for rotations.
oscillationAngledoublepi/2.0 The opening angle for oscillations.
rotationSensitivitydouble0.01 The rotation sensitivity.
oscillationSensitivitydouble0.3 The oscillation sensitivity.
attractionFormulaint1 The used formula for attraction (1 = Fruchterman / Reingold, 2 = GEM).
minDistCCdouble20 The minimal distance between connected components.
pageRatiodouble1.0 The page ratio used for the layout of connected components.

Definition at line 108 of file GEMLayout.h.

Constructor & Destructor Documentation

◆ GEMLayout() [1/2]

ogdf::GEMLayout::GEMLayout ( )

Creates an instance of GEM layout.

◆ GEMLayout() [2/2]

ogdf::GEMLayout::GEMLayout ( const GEMLayout fl)

Copy constructor.

◆ ~GEMLayout()

ogdf::GEMLayout::~GEMLayout ( )

Member Function Documentation

◆ attractionFormula() [1/2]

int ogdf::GEMLayout::attractionFormula ( ) const
inline

Returns the used formula for attraction (1 = Fruchterman / Reingold, 2 = GEM).

Definition at line 256 of file GEMLayout.h.

◆ attractionFormula() [2/2]

void ogdf::GEMLayout::attractionFormula ( int  n)
inline

sets the formula for attraction to n (1 = Fruchterman / Reingold, 2 = GEM).

Definition at line 259 of file GEMLayout.h.

◆ call()

virtual void ogdf::GEMLayout::call ( GraphAttributes GA)
overridevirtual

Calls the layout algorithm for graph attributes GA.

Implements ogdf::LayoutModule.

◆ computeImpulse()

void ogdf::GEMLayout::computeImpulse ( GraphCopy GC,
GraphAttributes AGC,
node  v 
)
private

Computes the new impulse for node v.

◆ desiredLength() [1/2]

double ogdf::GEMLayout::desiredLength ( ) const
inline

Returns the desired edge length.

Definition at line 188 of file GEMLayout.h.

◆ desiredLength() [2/2]

void ogdf::GEMLayout::desiredLength ( double  x)
inline

Sets the desired edge length to x; must be >= 0.

Definition at line 191 of file GEMLayout.h.

◆ gravitationalConstant() [1/2]

double ogdf::GEMLayout::gravitationalConstant ( ) const
inline

Returns the gravitational constant.

Definition at line 181 of file GEMLayout.h.

◆ gravitationalConstant() [2/2]

void ogdf::GEMLayout::gravitationalConstant ( double  x)
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.

◆ initialTemperature() [1/2]

double ogdf::GEMLayout::initialTemperature ( ) const
inline

Returns the initial temperature.

Definition at line 173 of file GEMLayout.h.

◆ initialTemperature() [2/2]

void ogdf::GEMLayout::initialTemperature ( double  x)
inline

Sets the initial temperature to x; must be >= minimalTemperature.

Definition at line 176 of file GEMLayout.h.

◆ length()

double ogdf::GEMLayout::length ( double  x,
double  y = 0 
) const
inlineprivate

Returns the length of the vector (x,y).

Definition at line 280 of file GEMLayout.h.

◆ maximalDisturbance() [1/2]

double ogdf::GEMLayout::maximalDisturbance ( ) const
inline

Returns the maximal disturbance.

Definition at line 194 of file GEMLayout.h.

◆ maximalDisturbance() [2/2]

void ogdf::GEMLayout::maximalDisturbance ( double  x)
inline

Sets the maximal disturbance to x; must be >= 0.

Definition at line 197 of file GEMLayout.h.

◆ minDistCC() [1/2]

double ogdf::GEMLayout::minDistCC ( ) const
inline

Returns the minimal distance between connected components.

Definition at line 266 of file GEMLayout.h.

◆ minDistCC() [2/2]

void ogdf::GEMLayout::minDistCC ( double  x)
inline

Sets the minimal distance between connected components to x.

Definition at line 269 of file GEMLayout.h.

◆ minimalTemperature() [1/2]

double ogdf::GEMLayout::minimalTemperature ( ) const
inline

Returns the minimal temperature.

Definition at line 167 of file GEMLayout.h.

◆ minimalTemperature() [2/2]

void ogdf::GEMLayout::minimalTemperature ( double  x)
inline

Sets the minimal temperature to x.

Definition at line 170 of file GEMLayout.h.

◆ numberOfRounds() [1/2]

int ogdf::GEMLayout::numberOfRounds ( ) const
inline

Returns the maximal number of rounds per node.

Definition at line 161 of file GEMLayout.h.

◆ numberOfRounds() [2/2]

void ogdf::GEMLayout::numberOfRounds ( int  n)
inline

Sets the maximal number of round per node to n.

Definition at line 164 of file GEMLayout.h.

◆ operator=()

GEMLayout& ogdf::GEMLayout::operator= ( const GEMLayout fl)

Assignment operator.

◆ oscillationAngle() [1/2]

double ogdf::GEMLayout::oscillationAngle ( ) const
inline

Returns the opening angle for oscillations.

Definition at line 214 of file GEMLayout.h.

◆ oscillationAngle() [2/2]

void ogdf::GEMLayout::oscillationAngle ( double  x)
inline

Sets the opening angle for oscillations to x (0 <= x <= pi / 2).

Definition at line 217 of file GEMLayout.h.

◆ oscillationSensitivity() [1/2]

double ogdf::GEMLayout::oscillationSensitivity ( ) const
inline

Returns the oscillation sensitivity.

Definition at line 242 of file GEMLayout.h.

◆ oscillationSensitivity() [2/2]

void ogdf::GEMLayout::oscillationSensitivity ( double  x)
inline

Sets the oscillation sensitivity to x (0 <= x <= 1).

Definition at line 245 of file GEMLayout.h.

◆ pageRatio() [1/2]

double ogdf::GEMLayout::pageRatio ( ) const
inline

Returns the page ratio used for the layout of connected components.

Definition at line 272 of file GEMLayout.h.

◆ pageRatio() [2/2]

void ogdf::GEMLayout::pageRatio ( double  x)
inline

Sets the page ratio used for the layout of connected components to x.

Definition at line 275 of file GEMLayout.h.

◆ rotationAngle() [1/2]

double ogdf::GEMLayout::rotationAngle ( ) const
inline

Returns the opening angle for rotations.

Definition at line 200 of file GEMLayout.h.

◆ rotationAngle() [2/2]

void ogdf::GEMLayout::rotationAngle ( double  x)
inline

Sets the opening angle for rotations to x (0 <= x <= pi / 2).

Definition at line 203 of file GEMLayout.h.

◆ rotationSensitivity() [1/2]

double ogdf::GEMLayout::rotationSensitivity ( ) const
inline

Returns the rotation sensitivity.

Definition at line 228 of file GEMLayout.h.

◆ rotationSensitivity() [2/2]

void ogdf::GEMLayout::rotationSensitivity ( double  x)
inline

Sets the rotation sensitivity to x (0 <= x <= 1).

Definition at line 231 of file GEMLayout.h.

◆ updateNode()

void ogdf::GEMLayout::updateNode ( GraphCopy GC,
GraphAttributes AGC,
node  v 
)
private

Updates the node data for node v.

◆ weight()

double ogdf::GEMLayout::weight ( node  v) const
inlineprivate

Returns the weight of node v according to its degree.

Definition at line 283 of file GEMLayout.h.

Member Data Documentation

◆ m_attractionFormula

int ogdf::GEMLayout::m_attractionFormula
private

The used formula for attraction.

Definition at line 121 of file GEMLayout.h.

◆ m_barycenterX

double ogdf::GEMLayout::m_barycenterX
private

Weighted sum of x-coordinates of all nodes.

Definition at line 134 of file GEMLayout.h.

◆ m_barycenterY

double ogdf::GEMLayout::m_barycenterY
private

Weighted sum of y-coordinates of all nodes.

Definition at line 135 of file GEMLayout.h.

◆ m_cos

double ogdf::GEMLayout::m_cos
private

Cosine of m_oscillationAngle / 2.

Definition at line 139 of file GEMLayout.h.

◆ m_desiredLength

double ogdf::GEMLayout::m_desiredLength
private

The desired edge length.

Definition at line 115 of file GEMLayout.h.

◆ m_globalTemperature

double ogdf::GEMLayout::m_globalTemperature
private

Average of all node temperatures.

Definition at line 138 of file GEMLayout.h.

◆ m_gravitationalConstant

double ogdf::GEMLayout::m_gravitationalConstant
private

The gravitational constant.

Definition at line 114 of file GEMLayout.h.

◆ m_impulseX

NodeArray<double> ogdf::GEMLayout::m_impulseX
private

x-coordinate of the last impulse of the node

Definition at line 127 of file GEMLayout.h.

◆ m_impulseY

NodeArray<double> ogdf::GEMLayout::m_impulseY
private

y-coordinate of the last impulse of the node

Definition at line 128 of file GEMLayout.h.

◆ m_initialTemperature

double ogdf::GEMLayout::m_initialTemperature
private

The initial temperature.

Definition at line 113 of file GEMLayout.h.

◆ m_localTemperature

NodeArray<double> ogdf::GEMLayout::m_localTemperature
private

local temperature of the node

Definition at line 129 of file GEMLayout.h.

◆ m_maximalDisturbance

double ogdf::GEMLayout::m_maximalDisturbance
private

The maximal disturbance.

Definition at line 116 of file GEMLayout.h.

◆ m_minDistCC

double ogdf::GEMLayout::m_minDistCC
private

The minimal distance between connected components.

Definition at line 122 of file GEMLayout.h.

◆ m_minimalTemperature

double ogdf::GEMLayout::m_minimalTemperature
private

The minimal temperature.

Definition at line 112 of file GEMLayout.h.

◆ m_newImpulseX

double ogdf::GEMLayout::m_newImpulseX
private

x-coordinate of the new impulse of the current node.

Definition at line 136 of file GEMLayout.h.

◆ m_newImpulseY

double ogdf::GEMLayout::m_newImpulseY
private

y-coordinate of the new impulse of the current node.

Definition at line 137 of file GEMLayout.h.

◆ m_numberOfRounds

int ogdf::GEMLayout::m_numberOfRounds
private

The maximal number of rounds per node.

Definition at line 111 of file GEMLayout.h.

◆ m_oscillationAngle

double ogdf::GEMLayout::m_oscillationAngle
private

The opening angle for oscillations.

Definition at line 118 of file GEMLayout.h.

◆ m_oscillationSensitivity

double ogdf::GEMLayout::m_oscillationSensitivity
private

The oscillation sensitivity.

Definition at line 120 of file GEMLayout.h.

◆ m_pageRatio

double ogdf::GEMLayout::m_pageRatio
private

The page ratio used for the layout of connected components.

Definition at line 123 of file GEMLayout.h.

◆ m_rng

std::minstd_rand ogdf::GEMLayout::m_rng
private

Definition at line 142 of file GEMLayout.h.

◆ m_rotationAngle

double ogdf::GEMLayout::m_rotationAngle
private

The opening angle for rotations.

Definition at line 117 of file GEMLayout.h.

◆ m_rotationSensitivity

double ogdf::GEMLayout::m_rotationSensitivity
private

The rotation sensitivity.

Definition at line 119 of file GEMLayout.h.

◆ m_sin

double ogdf::GEMLayout::m_sin
private

Sine of (pi + m_rotationAngle) / 2.

Definition at line 140 of file GEMLayout.h.

◆ m_skewGauge

NodeArray<double> ogdf::GEMLayout::m_skewGauge
private

skew gauge of the node

Definition at line 130 of file GEMLayout.h.


The documentation for this class was generated from the following file: