The spring-embedder layout algorithm with force approximation using hte grid variant approach. More...
#include <ogdf/energybased/SpringEmbedderGridVariant.h>
Inheritance diagram for ogdf::SpringEmbedderGridVariant:Classes | |
| class | ForceModelBase |
| class | ForceModelEades |
| class | ForceModelFR |
| class | ForceModelFRModAttr |
| class | ForceModelFRModRep |
| class | ForceModelGronemann |
| class | ForceModelHachul |
| struct | NodeInfo |
Public Types | |
| enum | Scaling { Scaling::input, Scaling::userBoundingBox, Scaling::scaleFunction, Scaling::useIdealEdgeLength } |
| The scaling method used by the algorithm. More... | |
Public Member Functions | |
| SpringEmbedderGridVariant () | |
| Creates an instance of Fruchterman/Reingold layout. More... | |
| ~SpringEmbedderGridVariant () | |
| 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 |
Calls the layout algorithm for graph attributes 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... | |
| 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... | |
Private Attributes | |
| double | m_avgConvergenceFactor |
| convergence if avg. More... | |
| 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... | |
| 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... | |
| double | m_xleft |
| Bounding box (minimal x-coordinate). More... | |
| double | m_xright |
| Bounding box (maximal x-coordinate). More... | |
| double | m_ybig |
| Bounding box (maximal y-coordinate). More... | |
| double | m_ysmall |
| Bounding box (minimal y-coordinate). More... | |
The spring-embedder layout algorithm with force approximation using hte grid variant approach.
The implementation used in SpringEmbedderGridVariant 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.
Fruchterman/Reingold layout provides the following optional parameters.
| Option | Type | Default | Description |
|---|---|---|---|
| iterations | int | 400 | The number of iterations performed in the optimization. |
| noise | bool | true | If set to true, (small) random perturbations are performed. |
| minDistCC | double | 20.0 | The minimum distance between connected components. |
| pageRatio | double | 1.0 | The page ratio. |
| scaling | Scaling | Scaling::scaleFunction | The scaling method for scaling the inital layout. |
| scaleFunctionFactor | double | 8.0 | The scale function factor (used if scaling = scaleFunction). |
| userBoundingBox | rectangle | (0.0,100.0,0.0,100.0) | The user bounding box for scaling (used if scaling = scUserBoundingBox). |
Definition at line 81 of file SpringEmbedderGridVariant.h.
|
strong |
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 85 of file SpringEmbedderGridVariant.h.
| ogdf::SpringEmbedderGridVariant::SpringEmbedderGridVariant | ( | ) |
Creates an instance of Fruchterman/Reingold layout.
|
inline |
Definition at line 97 of file SpringEmbedderGridVariant.h.
|
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 133 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the average convergence factor to f.
Definition at line 138 of file SpringEmbedderGridVariant.h.
|
overridevirtual |
Calls the layout algorithm for graph attributes GA.
Implements ogdf::LayoutModule.
|
inline |
Definition at line 190 of file SpringEmbedderGridVariant.h.
|
inline |
Definition at line 194 of file SpringEmbedderGridVariant.h.
|
inline |
Returns the currently used force model.
Definition at line 108 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the used force model to fm.
Definition at line 113 of file SpringEmbedderGridVariant.h.
|
inline |
Returns the currently used force model for the improvement step.
Definition at line 118 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the used force model for the improvement step to fm.
Definition at line 123 of file SpringEmbedderGridVariant.h.
|
inline |
Returns the current setting of ideal edge length.
Definition at line 186 of file SpringEmbedderGridVariant.h.
|
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 203 of file SpringEmbedderGridVariant.h.
|
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 164 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the number of iterations to i.
Definition at line 169 of file SpringEmbedderGridVariant.h.
|
inline |
Returns the current setting of iterations for the improvement phase.
Definition at line 175 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the number of iterations for the improvement phase to i.
Definition at line 180 of file SpringEmbedderGridVariant.h.
|
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 149 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the maximum convergence factor to f.
Definition at line 154 of file SpringEmbedderGridVariant.h.
|
inline |
Returns the maximal number of used threads.
Definition at line 258 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the maximal number of used threads to n.
Definition at line 261 of file SpringEmbedderGridVariant.h.
|
inline |
Returns the minimum distance between connected components.
Definition at line 218 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the minimum distance between connected components to x.
Definition at line 221 of file SpringEmbedderGridVariant.h.
|
inline |
Returns the current setting of noise.
Definition at line 208 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the parameter noise to on.
Definition at line 213 of file SpringEmbedderGridVariant.h.
|
inline |
Returns the page ratio.
Definition at line 224 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the page ration to x.
Definition at line 227 of file SpringEmbedderGridVariant.h.
|
inline |
Returns the current scale function factor.
Definition at line 240 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the scale function factor to f.
Definition at line 245 of file SpringEmbedderGridVariant.h.
|
inline |
Returns the current scaling method.
Definition at line 230 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the method for scaling the inital layout to sc.
Definition at line 235 of file SpringEmbedderGridVariant.h.
|
inline |
Sets the user bounding box (used if scaling method is scUserBoundingBox).
Definition at line 250 of file SpringEmbedderGridVariant.h.
|
private |
convergence if avg.
displacement is at most this factor times ideal edge length
Definition at line 315 of file SpringEmbedderGridVariant.h.
|
private |
User bounding box (minimal y-coordinate).
Definition at line 309 of file SpringEmbedderGridVariant.h.
|
private |
User bounding box (minimal x-coordinate).
Definition at line 307 of file SpringEmbedderGridVariant.h.
|
private |
User bounding box (maximal y-coordinate).
Definition at line 310 of file SpringEmbedderGridVariant.h.
|
private |
User bounding box (maximal x-coordinate).
Definition at line 308 of file SpringEmbedderGridVariant.h.
|
private |
Definition at line 292 of file SpringEmbedderGridVariant.h.
|
private |
Definition at line 293 of file SpringEmbedderGridVariant.h.
|
private |
Definition at line 300 of file SpringEmbedderGridVariant.h.
|
private |
The used force model.
Definition at line 301 of file SpringEmbedderGridVariant.h.
|
private |
The ideal edge length.
Definition at line 291 of file SpringEmbedderGridVariant.h.
|
private |
The number of iterations.
Definition at line 287 of file SpringEmbedderGridVariant.h.
|
private |
The number of iterations for the improvement phase.
Definition at line 290 of file SpringEmbedderGridVariant.h.
|
private |
convergence if max.
displacement is at most this factor times ideal edge length
Definition at line 316 of file SpringEmbedderGridVariant.h.
|
private |
The maximal number of used threads.
Definition at line 318 of file SpringEmbedderGridVariant.h.
|
private |
The minimal distance between connected components.
Definition at line 312 of file SpringEmbedderGridVariant.h.
|
private |
The used force model for the improvement phase.
Perform random perturbations?
Definition at line 302 of file SpringEmbedderGridVariant.h.
|
private |
The page ratio.
Definition at line 313 of file SpringEmbedderGridVariant.h.
|
private |
The factor used if scaling type is scScaleFunction.
Definition at line 305 of file SpringEmbedderGridVariant.h.
|
private |
The scaling method.
Definition at line 304 of file SpringEmbedderGridVariant.h.
|
private |
Bounding box (minimal x-coordinate).
Definition at line 295 of file SpringEmbedderGridVariant.h.
|
private |
Bounding box (maximal x-coordinate).
Definition at line 296 of file SpringEmbedderGridVariant.h.
|
private |
Bounding box (maximal y-coordinate).
Definition at line 298 of file SpringEmbedderGridVariant.h.
|
private |
Bounding box (minimal y-coordinate).
Definition at line 297 of file SpringEmbedderGridVariant.h.