Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::spring_embedder::SpringEmbedderBase Class Referenceabstract

Common base class for ogdf::SpringEmbedderBase and ogdf::SpringEmbedderGridVariant. More...

#include <ogdf/energybased/spring_embedder/SpringEmbedderBase.h>

+ Inheritance diagram for ogdf::spring_embedder::SpringEmbedderBase:

Public Types

enum  Scaling { Scaling::input, Scaling::userBoundingBox, Scaling::scaleFunction, Scaling::useIdealEdgeLength }
 The scaling method used by the algorithm. More...
 

Public Member Functions

 SpringEmbedderBase ()
 Constructor. More...
 
double avgConvergenceFactor () const
 Returns the currently used average convergence factor. More...
 
void avgConvergenceFactor (double f)
 Sets the average convergence factor to f. More...
 
virtual void call (GraphAttributes &GA) override
 Computes a layout of graph GA. More...
 
double coolDownFactor () const
 
double forceLimitStep () const
 
SpringForceModel forceModel () const
 Returns the currently used force model. More...
 
void forceModel (SpringForceModel fm)
 Sets the used force model to fm. More...
 
SpringForceModel forceModelImprove () const
 Returns the currently used force model for the improvement step. More...
 
void forceModelImprove (SpringForceModel fm)
 Sets the used force model for the improvement step to fm. More...
 
double idealEdgeLength () const
 Returns the current setting of ideal edge length. More...
 
void idealEdgeLength (double len)
 Sets the ideal edge length to len. More...
 
int iterations () const
 Returns the current setting of iterations. More...
 
void iterations (int i)
 Sets the number of iterations to i. More...
 
int iterationsImprove () const
 Returns the current setting of iterations for the improvement phase. More...
 
void iterationsImprove (int i)
 Sets the number of iterations for the improvement phase to i. More...
 
double maxConvergenceFactor () const
 Returns the currently used maximum convergence factor. More...
 
void maxConvergenceFactor (double f)
 Sets the maximum convergence factor to f. More...
 
unsigned int maxThreads () const
 Returns the maximal number of used threads. More...
 
void maxThreads (unsigned int n)
 Sets the maximal number of used threads to n. More...
 
double minDistCC () const
 Returns the minimum distance between connected components. More...
 
void minDistCC (double x)
 Sets the minimum distance between connected components to x. More...
 
bool noise () const
 Returns the current setting of noise. More...
 
void noise (bool on)
 Sets the parameter noise to on. More...
 
double pageRatio ()
 Returns the page ratio. More...
 
void pageRatio (double x)
 Sets the page ration to x. More...
 
double scaleFunctionFactor () const
 Returns the current scale function factor. More...
 
void scaleFunctionFactor (double f)
 Sets the scale function factor to f. More...
 
Scaling scaling () const
 Returns the current scaling method. More...
 
void scaling (Scaling sc)
 Sets the method for scaling the inital layout to sc. More...
 
DRect userBoundingBox () const
 Gets the user bounding box. More...
 
void userBoundingBox (double xmin, double ymin, double xmax, double ymax)
 Sets the user bounding box (used if scaling method is scUserBoundingBox). 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...
 

Protected Member Functions

virtual void callMaster (const GraphCopy &copy, GraphAttributes &attr, DPoint &box)=0
 

Protected Attributes

double m_avgConvergenceFactor
 convergence if avg. More...
 
DRect m_boundingBox
 
double m_coolDownFactor
 
double m_forceLimitStep
 
SpringForceModel m_forceModel
 
SpringForceModel m_forceModelImprove
 The used force model. More...
 
double m_idealEdgeLength
 The ideal edge length. More...
 
int m_iterations
 The number of iterations. More...
 
int m_iterationsImprove
 The number of iterations for the improvement phase. More...
 
double m_maxConvergenceFactor
 convergence if max. More...
 
unsigned int m_maxThreads
 The maximal number of used threads. More...
 
double m_minDistCC
 The minimal distance between connected components. More...
 
bool m_noise
 The used force model for the improvement phase. More...
 
double m_pageRatio
 The page ratio. More...
 
double m_scaleFactor
 The factor used if scaling type is scScaleFunction. More...
 
Scaling m_scaling
 The scaling method. More...
 
DRect m_userBoundingBox
 

Detailed Description

Common base class for ogdf::SpringEmbedderBase and ogdf::SpringEmbedderGridVariant.

Definition at line 54 of file SpringEmbedderBase.h.

Member Enumeration Documentation

◆ Scaling

The scaling method used by the algorithm.

Enumerator
input 

bounding box of input is used.

userBoundingBox 

bounding box set by userBoundingBox() is used.

scaleFunction 

automatic scaling is used with parameter set by scaleFunctionFactor() (larger factor, larger b-box).

useIdealEdgeLength 

use the given ideal edge length to scale the layout suitably.

Definition at line 57 of file SpringEmbedderBase.h.

Constructor & Destructor Documentation

◆ SpringEmbedderBase()

ogdf::spring_embedder::SpringEmbedderBase::SpringEmbedderBase ( )
inline

Constructor.

Definition at line 65 of file SpringEmbedderBase.h.

Member Function Documentation

◆ avgConvergenceFactor() [1/2]

double ogdf::spring_embedder::SpringEmbedderBase::avgConvergenceFactor ( ) const
inline

Returns the currently used average convergence factor.

This factor is used for detecting convergence of the energy system. With respect to the average displacement of a node in a single step, we assume to have convergence if it is at most m_avgConvergenceFactor * m_idealEdgeLength.

Definition at line 187 of file SpringEmbedderBase.h.

◆ avgConvergenceFactor() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::avgConvergenceFactor ( double  f)
inline

Sets the average convergence factor to f.

Definition at line 190 of file SpringEmbedderBase.h.

◆ call()

virtual void ogdf::spring_embedder::SpringEmbedderBase::call ( GraphAttributes GA)
inlineoverridevirtual

Computes a layout of graph GA.

This method is the actual algorithm call and must be implemented by derived classes.

Parameters
GAis the input graph and will also be assigned the layout information.

Implements ogdf::LayoutModule.

Definition at line 97 of file SpringEmbedderBase.h.

◆ callMaster()

virtual void ogdf::spring_embedder::SpringEmbedderBase::callMaster ( const GraphCopy copy,
GraphAttributes attr,
DPoint box 
)
protectedpure virtual

◆ coolDownFactor()

double ogdf::spring_embedder::SpringEmbedderBase::coolDownFactor ( ) const
inline

Definition at line 235 of file SpringEmbedderBase.h.

◆ forceLimitStep()

double ogdf::spring_embedder::SpringEmbedderBase::forceLimitStep ( ) const
inline

Definition at line 237 of file SpringEmbedderBase.h.

◆ forceModel() [1/2]

SpringForceModel ogdf::spring_embedder::SpringEmbedderBase::forceModel ( ) const
inline

Returns the currently used force model.

Definition at line 170 of file SpringEmbedderBase.h.

◆ forceModel() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::forceModel ( SpringForceModel  fm)
inline

Sets the used force model to fm.

Definition at line 173 of file SpringEmbedderBase.h.

◆ forceModelImprove() [1/2]

SpringForceModel ogdf::spring_embedder::SpringEmbedderBase::forceModelImprove ( ) const
inline

Returns the currently used force model for the improvement step.

Definition at line 176 of file SpringEmbedderBase.h.

◆ forceModelImprove() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::forceModelImprove ( SpringForceModel  fm)
inline

Sets the used force model for the improvement step to fm.

Definition at line 179 of file SpringEmbedderBase.h.

◆ idealEdgeLength() [1/2]

double ogdf::spring_embedder::SpringEmbedderBase::idealEdgeLength ( ) const
inline

Returns the current setting of ideal edge length.

Definition at line 240 of file SpringEmbedderBase.h.

◆ idealEdgeLength() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::idealEdgeLength ( double  len)
inline

Sets the ideal edge length to len.

Edge lengths are measured between the centers of the two nodes, i.e., node sizes are not taken into account.

Definition at line 247 of file SpringEmbedderBase.h.

◆ iterations() [1/2]

int ogdf::spring_embedder::SpringEmbedderBase::iterations ( ) const
inline

Returns the current setting of iterations.

This setting limits the number of optimization rounds. If convergence (with respect to node displacement) is detected, the optimization process is immediately finished.

Definition at line 216 of file SpringEmbedderBase.h.

◆ iterations() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::iterations ( int  i)
inline

Sets the number of iterations to i.

Definition at line 219 of file SpringEmbedderBase.h.

◆ iterationsImprove() [1/2]

int ogdf::spring_embedder::SpringEmbedderBase::iterationsImprove ( ) const
inline

Returns the current setting of iterations for the improvement phase.

Definition at line 226 of file SpringEmbedderBase.h.

◆ iterationsImprove() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::iterationsImprove ( int  i)
inline

Sets the number of iterations for the improvement phase to i.

Definition at line 229 of file SpringEmbedderBase.h.

◆ maxConvergenceFactor() [1/2]

double ogdf::spring_embedder::SpringEmbedderBase::maxConvergenceFactor ( ) const
inline

Returns the currently used maximum convergence factor.

This factor is used for detecting convergence of the energy system. With respect to the maximum displacement of a node in a single step, we assume to have convergence if it is at most m_maxConvergenceFactor * m_idealEdgeLength.

Definition at line 202 of file SpringEmbedderBase.h.

◆ maxConvergenceFactor() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::maxConvergenceFactor ( double  f)
inline

Sets the maximum convergence factor to f.

Definition at line 205 of file SpringEmbedderBase.h.

◆ maxThreads() [1/2]

unsigned int ogdf::spring_embedder::SpringEmbedderBase::maxThreads ( ) const
inline

Returns the maximal number of used threads.

Definition at line 288 of file SpringEmbedderBase.h.

◆ maxThreads() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::maxThreads ( unsigned int  n)
inline

Sets the maximal number of used threads to n.

Definition at line 291 of file SpringEmbedderBase.h.

◆ minDistCC() [1/2]

double ogdf::spring_embedder::SpringEmbedderBase::minDistCC ( ) const
inline

Returns the minimum distance between connected components.

Definition at line 256 of file SpringEmbedderBase.h.

◆ minDistCC() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::minDistCC ( double  x)
inline

Sets the minimum distance between connected components to x.

Definition at line 259 of file SpringEmbedderBase.h.

◆ noise() [1/2]

bool ogdf::spring_embedder::SpringEmbedderBase::noise ( ) const
inline

Returns the current setting of noise.

Definition at line 250 of file SpringEmbedderBase.h.

◆ noise() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::noise ( bool  on)
inline

Sets the parameter noise to on.

Definition at line 253 of file SpringEmbedderBase.h.

◆ pageRatio() [1/2]

double ogdf::spring_embedder::SpringEmbedderBase::pageRatio ( )
inline

Returns the page ratio.

Definition at line 262 of file SpringEmbedderBase.h.

◆ pageRatio() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::pageRatio ( double  x)
inline

Sets the page ration to x.

Definition at line 265 of file SpringEmbedderBase.h.

◆ scaleFunctionFactor() [1/2]

double ogdf::spring_embedder::SpringEmbedderBase::scaleFunctionFactor ( ) const
inline

Returns the current scale function factor.

Definition at line 274 of file SpringEmbedderBase.h.

◆ scaleFunctionFactor() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::scaleFunctionFactor ( double  f)
inline

Sets the scale function factor to f.

Definition at line 277 of file SpringEmbedderBase.h.

◆ scaling() [1/2]

Scaling ogdf::spring_embedder::SpringEmbedderBase::scaling ( ) const
inline

Returns the current scaling method.

Definition at line 268 of file SpringEmbedderBase.h.

◆ scaling() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::scaling ( Scaling  sc)
inline

Sets the method for scaling the inital layout to sc.

Definition at line 271 of file SpringEmbedderBase.h.

◆ userBoundingBox() [1/2]

DRect ogdf::spring_embedder::SpringEmbedderBase::userBoundingBox ( ) const
inline

Gets the user bounding box.

Definition at line 285 of file SpringEmbedderBase.h.

◆ userBoundingBox() [2/2]

void ogdf::spring_embedder::SpringEmbedderBase::userBoundingBox ( double  xmin,
double  ymin,
double  xmax,
double  ymax 
)
inline

Sets the user bounding box (used if scaling method is scUserBoundingBox).

Definition at line 280 of file SpringEmbedderBase.h.

Member Data Documentation

◆ m_avgConvergenceFactor

double ogdf::spring_embedder::SpringEmbedderBase::m_avgConvergenceFactor
protected

convergence if avg.

displacement is at most this factor times ideal edge length

Definition at line 316 of file SpringEmbedderBase.h.

◆ m_boundingBox

DRect ogdf::spring_embedder::SpringEmbedderBase::m_boundingBox
protected

Definition at line 302 of file SpringEmbedderBase.h.

◆ m_coolDownFactor

double ogdf::spring_embedder::SpringEmbedderBase::m_coolDownFactor
protected

Definition at line 299 of file SpringEmbedderBase.h.

◆ m_forceLimitStep

double ogdf::spring_embedder::SpringEmbedderBase::m_forceLimitStep
protected

Definition at line 300 of file SpringEmbedderBase.h.

◆ m_forceModel

SpringForceModel ogdf::spring_embedder::SpringEmbedderBase::m_forceModel
protected

Definition at line 304 of file SpringEmbedderBase.h.

◆ m_forceModelImprove

SpringForceModel ogdf::spring_embedder::SpringEmbedderBase::m_forceModelImprove
protected

The used force model.

Definition at line 305 of file SpringEmbedderBase.h.

◆ m_idealEdgeLength

double ogdf::spring_embedder::SpringEmbedderBase::m_idealEdgeLength
protected

The ideal edge length.

Definition at line 298 of file SpringEmbedderBase.h.

◆ m_iterations

int ogdf::spring_embedder::SpringEmbedderBase::m_iterations
protected

The number of iterations.

Definition at line 296 of file SpringEmbedderBase.h.

◆ m_iterationsImprove

int ogdf::spring_embedder::SpringEmbedderBase::m_iterationsImprove
protected

The number of iterations for the improvement phase.

Definition at line 297 of file SpringEmbedderBase.h.

◆ m_maxConvergenceFactor

double ogdf::spring_embedder::SpringEmbedderBase::m_maxConvergenceFactor
protected

convergence if max.

displacement is at most this factor times ideal edge length

Definition at line 317 of file SpringEmbedderBase.h.

◆ m_maxThreads

unsigned int ogdf::spring_embedder::SpringEmbedderBase::m_maxThreads
protected

The maximal number of used threads.

Definition at line 319 of file SpringEmbedderBase.h.

◆ m_minDistCC

double ogdf::spring_embedder::SpringEmbedderBase::m_minDistCC
protected

The minimal distance between connected components.

Definition at line 313 of file SpringEmbedderBase.h.

◆ m_noise

bool ogdf::spring_embedder::SpringEmbedderBase::m_noise
protected

The used force model for the improvement phase.

Perform random perturbations?

Definition at line 306 of file SpringEmbedderBase.h.

◆ m_pageRatio

double ogdf::spring_embedder::SpringEmbedderBase::m_pageRatio
protected

The page ratio.

Definition at line 314 of file SpringEmbedderBase.h.

◆ m_scaleFactor

double ogdf::spring_embedder::SpringEmbedderBase::m_scaleFactor
protected

The factor used if scaling type is scScaleFunction.

Definition at line 309 of file SpringEmbedderBase.h.

◆ m_scaling

Scaling ogdf::spring_embedder::SpringEmbedderBase::m_scaling
protected

The scaling method.

Definition at line 308 of file SpringEmbedderBase.h.

◆ m_userBoundingBox

DRect ogdf::spring_embedder::SpringEmbedderBase::m_userBoundingBox
protected

Definition at line 311 of file SpringEmbedderBase.h.


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