Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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.
 
 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.
 
GEMLayoutoperator= (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< doublem_impulseX
 x-coordinate of the last impulse of the node
 
NodeArray< doublem_impulseY
 y-coordinate of the last impulse of the node
 
double m_initialTemperature
 The initial temperature.
 
NodeArray< doublem_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< doublem_skewGauge
 skew gauge of the node
 

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 104 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 252 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 255 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 184 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 187 of file GEMLayout.h.

◆ gravitationalConstant() [1/2]

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

Returns the gravitational constant.

Definition at line 177 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 181 of file GEMLayout.h.

◆ initialTemperature() [1/2]

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

Returns the initial temperature.

Definition at line 169 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 172 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 276 of file GEMLayout.h.

◆ maximalDisturbance() [1/2]

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

Returns the maximal disturbance.

Definition at line 190 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 193 of file GEMLayout.h.

◆ minDistCC() [1/2]

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

Returns the minimal distance between connected components.

Definition at line 262 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 265 of file GEMLayout.h.

◆ minimalTemperature() [1/2]

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

Returns the minimal temperature.

Definition at line 163 of file GEMLayout.h.

◆ minimalTemperature() [2/2]

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

Sets the minimal temperature to x.

Definition at line 166 of file GEMLayout.h.

◆ numberOfRounds() [1/2]

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

Returns the maximal number of rounds per node.

Definition at line 157 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 160 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 210 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 213 of file GEMLayout.h.

◆ oscillationSensitivity() [1/2]

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

Returns the oscillation sensitivity.

Definition at line 238 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 241 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 268 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 271 of file GEMLayout.h.

◆ rotationAngle() [1/2]

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

Returns the opening angle for rotations.

Definition at line 196 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 199 of file GEMLayout.h.

◆ rotationSensitivity() [1/2]

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

Returns the rotation sensitivity.

Definition at line 224 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 227 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 279 of file GEMLayout.h.

Member Data Documentation

◆ m_attractionFormula

int ogdf::GEMLayout::m_attractionFormula
private

The used formula for attraction.

Definition at line 117 of file GEMLayout.h.

◆ m_barycenterX

double ogdf::GEMLayout::m_barycenterX
private

Weighted sum of x-coordinates of all nodes.

Definition at line 130 of file GEMLayout.h.

◆ m_barycenterY

double ogdf::GEMLayout::m_barycenterY
private

Weighted sum of y-coordinates of all nodes.

Definition at line 131 of file GEMLayout.h.

◆ m_cos

double ogdf::GEMLayout::m_cos
private

Cosine of m_oscillationAngle / 2.

Definition at line 135 of file GEMLayout.h.

◆ m_desiredLength

double ogdf::GEMLayout::m_desiredLength
private

The desired edge length.

Definition at line 111 of file GEMLayout.h.

◆ m_globalTemperature

double ogdf::GEMLayout::m_globalTemperature
private

Average of all node temperatures.

Definition at line 134 of file GEMLayout.h.

◆ m_gravitationalConstant

double ogdf::GEMLayout::m_gravitationalConstant
private

The gravitational constant.

Definition at line 110 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 123 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 124 of file GEMLayout.h.

◆ m_initialTemperature

double ogdf::GEMLayout::m_initialTemperature
private

The initial temperature.

Definition at line 109 of file GEMLayout.h.

◆ m_localTemperature

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

local temperature of the node

Definition at line 125 of file GEMLayout.h.

◆ m_maximalDisturbance

double ogdf::GEMLayout::m_maximalDisturbance
private

The maximal disturbance.

Definition at line 112 of file GEMLayout.h.

◆ m_minDistCC

double ogdf::GEMLayout::m_minDistCC
private

The minimal distance between connected components.

Definition at line 118 of file GEMLayout.h.

◆ m_minimalTemperature

double ogdf::GEMLayout::m_minimalTemperature
private

The minimal temperature.

Definition at line 108 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 132 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 133 of file GEMLayout.h.

◆ m_numberOfRounds

int ogdf::GEMLayout::m_numberOfRounds
private

The maximal number of rounds per node.

Definition at line 107 of file GEMLayout.h.

◆ m_oscillationAngle

double ogdf::GEMLayout::m_oscillationAngle
private

The opening angle for oscillations.

Definition at line 114 of file GEMLayout.h.

◆ m_oscillationSensitivity

double ogdf::GEMLayout::m_oscillationSensitivity
private

The oscillation sensitivity.

Definition at line 116 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 119 of file GEMLayout.h.

◆ m_rng

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

Definition at line 138 of file GEMLayout.h.

◆ m_rotationAngle

double ogdf::GEMLayout::m_rotationAngle
private

The opening angle for rotations.

Definition at line 113 of file GEMLayout.h.

◆ m_rotationSensitivity

double ogdf::GEMLayout::m_rotationSensitivity
private

The rotation sensitivity.

Definition at line 115 of file GEMLayout.h.

◆ m_sin

double ogdf::GEMLayout::m_sin
private

Sine of (pi + m_rotationAngle) / 2.

Definition at line 136 of file GEMLayout.h.

◆ m_skewGauge

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

skew gauge of the node

Definition at line 126 of file GEMLayout.h.


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