Open
Graph Drawing
Framework

 v.2015.05
 

ogdf::SpringEmbedderFR Class Reference

The spring-embedder layout algorithm by Fruchterman and Reingold. More...

#include <ogdf/energybased/SpringEmbedderFR.h>

+ Inheritance diagram for ogdf::SpringEmbedderFR:

Public Types

enum  Scaling { scInput, scUserBoundingBox, scScaleFunction }
 The scaling method used by the algorithm. More...
 

Public Member Functions

 SpringEmbedderFR ()
 Creates an instance of Fruchterman/Reingold layout. More...
 
 ~SpringEmbedderFR ()
 
void call (GraphAttributes &GA)
 Calls the layout algorithm for graph attributes GA. More...
 
double fineness () const
 
void fineness (double f)
 
int iterations () const
 Returns the current setting of iterations. More...
 
void iterations (int i)
 Sets the number of iterations to i. 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 nodes. 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...
 
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 ()
 
virtual void call (GraphAttributes &GA, GraphConstraints &GC)
 Computes a layout of graph GA wrt the constraints in GC (if applicable). More...
 
void operator() (GraphAttributes &GA)
 Computes a layout of graph GA. More...
 

Private Member Functions

void cleanup ()
 
bool initialize (GraphCopy &G, GraphCopyAttributes &AG)
 
void mainStep (GraphCopy &G, GraphCopyAttributes &AG)
 
double mylog2 (int x)
 

Private Attributes

Array2D< List< node > > * m_A
 
double m_bbXmax
 User bounding box (minimal y-coordinate). More...
 
double m_bbXmin
 User bounding box (minimal x-coordinate). More...
 
double m_bbYmax
 User bounding box (maximal y-coordinate). More...
 
double m_bbYmin
 User bounding box (maximal x-coordinate). More...
 
int m_cF
 
double m_fineness
 The fineness of the grid. More...
 
double m_height
 
int m_iterations
 The number of iterations. More...
 
double m_k
 
double m_k2
 
int m_ki
 
double m_kk
 
NodeArray< ListIterator< node > > m_lit
 
double m_minDistCC
 The minimal distance between connected components. More...
 
bool m_noise
 Perform random perturbations? 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...
 
double m_tx
 
double m_txNull
 
double m_ty
 
double m_tyNull
 
double m_width
 
int m_xA
 
double m_xleft
 Bounding box (minimal x-coordinate). More...
 
double m_xright
 Bounding box (maximal x-coordinate). More...
 
int m_yA
 
double m_ybig
 Bounding box (maximal y-coordinate). More...
 
double m_ysmall
 Bounding box (minimal y-coordinate). More...
 

Detailed Description

The spring-embedder layout algorithm by Fruchterman and Reingold.

The implementation used in SpringEmbedderFR is based on the following publication:

Thomas M. J. Fruchterman, Edward M. Reingold: Graph Drawing by Force-directed Placement. Software - Practice and Experience 21(11), pp. 1129-1164, 1991.

Optional parameters

Fruchterman/Reingold layout provides the following optional parameters.

OptionTypeDefaultDescription
iterationsint400 The number of iterations performed in the optimization.
noisebooltrue If set to true, (small) random perturbations are performed.
minDistCCdouble20.0 The minimum distance between connected components.
pageRatiodouble1.0 The page ratio.
scalingScaling scScaleFunction The scaling method for scaling the inital layout.
scaleFunctionFactordouble8.0 The scale function factor (used if scaling = scScaleFunction).
userBoundingBoxrectangle(0.0,100.0,0.0,100.0) The user bounding box for scaling (used if scaling = scUserBoundingBox).

Definition at line 102 of file SpringEmbedderFR.h.

Member Enumeration Documentation

The scaling method used by the algorithm.

Enumerator
scInput 

bounding box of input is used.

scUserBoundingBox 

bounding box set by userBoundingBox() is used.

scScaleFunction 

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

Definition at line 106 of file SpringEmbedderFR.h.

Constructor & Destructor Documentation

ogdf::SpringEmbedderFR::SpringEmbedderFR ( )

Creates an instance of Fruchterman/Reingold layout.

ogdf::SpringEmbedderFR::~SpringEmbedderFR ( )
inline

Definition at line 117 of file SpringEmbedderFR.h.

Member Function Documentation

void ogdf::SpringEmbedderFR::call ( GraphAttributes GA)
virtual

Calls the layout algorithm for graph attributes GA.

Implements ogdf::LayoutModule.

void ogdf::SpringEmbedderFR::cleanup ( )
inlineprivate

Definition at line 197 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::fineness ( ) const
inline

Definition at line 135 of file SpringEmbedderFR.h.

void ogdf::SpringEmbedderFR::fineness ( double  f)
inline

Definition at line 139 of file SpringEmbedderFR.h.

bool ogdf::SpringEmbedderFR::initialize ( GraphCopy G,
GraphCopyAttributes AG 
)
private
int ogdf::SpringEmbedderFR::iterations ( ) const
inline

Returns the current setting of iterations.

Definition at line 125 of file SpringEmbedderFR.h.

void ogdf::SpringEmbedderFR::iterations ( int  i)
inline

Sets the number of iterations to i.

Definition at line 130 of file SpringEmbedderFR.h.

void ogdf::SpringEmbedderFR::mainStep ( GraphCopy G,
GraphCopyAttributes AG 
)
private
double ogdf::SpringEmbedderFR::minDistCC ( ) const
inline

Returns the minimum distance between connected components.

Definition at line 154 of file SpringEmbedderFR.h.

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

Sets the minimum distance between connected components to x.

Definition at line 157 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::mylog2 ( int  x)
inlineprivate

Definition at line 225 of file SpringEmbedderFR.h.

bool ogdf::SpringEmbedderFR::noise ( ) const
inline

Returns the current setting of nodes.

Definition at line 144 of file SpringEmbedderFR.h.

void ogdf::SpringEmbedderFR::noise ( bool  on)
inline

Sets the parameter noise to on.

Definition at line 149 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::pageRatio ( )
inline

Returns the page ratio.

Definition at line 160 of file SpringEmbedderFR.h.

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

Sets the page ration to x.

Definition at line 163 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::scaleFunctionFactor ( ) const
inline

Returns the current scale function factor.

Definition at line 176 of file SpringEmbedderFR.h.

void ogdf::SpringEmbedderFR::scaleFunctionFactor ( double  f)
inline

Sets the scale function factor to f.

Definition at line 181 of file SpringEmbedderFR.h.

Scaling ogdf::SpringEmbedderFR::scaling ( ) const
inline

Returns the current scaling method.

Definition at line 166 of file SpringEmbedderFR.h.

void ogdf::SpringEmbedderFR::scaling ( Scaling  sc)
inline

Sets the method for scaling the inital layout to sc.

Definition at line 171 of file SpringEmbedderFR.h.

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

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

Definition at line 186 of file SpringEmbedderFR.h.

Member Data Documentation

Array2D<List<node> >* ogdf::SpringEmbedderFR::m_A
private

Definition at line 222 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_bbXmax
private

User bounding box (minimal y-coordinate).

Definition at line 249 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_bbXmin
private

User bounding box (minimal x-coordinate).

Definition at line 247 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_bbYmax
private

User bounding box (maximal y-coordinate).

Definition at line 250 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_bbYmin
private

User bounding box (maximal x-coordinate).

Definition at line 248 of file SpringEmbedderFR.h.

int ogdf::SpringEmbedderFR::m_cF
private

Definition at line 204 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_fineness
private

The fineness of the grid.

Definition at line 235 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_height
private

Definition at line 207 of file SpringEmbedderFR.h.

int ogdf::SpringEmbedderFR::m_iterations
private

The number of iterations.

Definition at line 234 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_k
private

Definition at line 214 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_k2
private

Definition at line 215 of file SpringEmbedderFR.h.

int ogdf::SpringEmbedderFR::m_ki
private

Definition at line 217 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_kk
private

Definition at line 216 of file SpringEmbedderFR.h.

NodeArray<ListIterator<node> > ogdf::SpringEmbedderFR::m_lit
private

Definition at line 202 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_minDistCC
private

The minimal distance between connected components.

Definition at line 252 of file SpringEmbedderFR.h.

bool ogdf::SpringEmbedderFR::m_noise
private

Perform random perturbations?

Definition at line 242 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_pageRatio
private

The page ratio.

Definition at line 253 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_scaleFactor
private

The factor used if scaling type is scScaleFunction.

Definition at line 245 of file SpringEmbedderFR.h.

Scaling ogdf::SpringEmbedderFR::m_scaling
private

The scaling method.

Definition at line 244 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_tx
private

Definition at line 211 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_txNull
private

Definition at line 209 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_ty
private

Definition at line 212 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_tyNull
private

Definition at line 210 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_width
private

Definition at line 206 of file SpringEmbedderFR.h.

int ogdf::SpringEmbedderFR::m_xA
private

Definition at line 219 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_xleft
private

Bounding box (minimal x-coordinate).

Definition at line 237 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_xright
private

Bounding box (maximal x-coordinate).

Definition at line 238 of file SpringEmbedderFR.h.

int ogdf::SpringEmbedderFR::m_yA
private

Definition at line 220 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_ybig
private

Bounding box (maximal y-coordinate).

Definition at line 240 of file SpringEmbedderFR.h.

double ogdf::SpringEmbedderFR::m_ysmall
private

Bounding box (minimal y-coordinate).

Definition at line 239 of file SpringEmbedderFR.h.


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