The NodeRespecterLayout layout algorithm. More...
#include <ogdf/energybased/NodeRespecterLayout.h>
Public Types | |
enum | PostProcessingMode { PostProcessingMode::None, PostProcessingMode::KeepMultiEdgeBends, PostProcessingMode::Complete } |
Sets whether unnecessary edge bends should be filtered out in a post-processing step. More... | |
Public Member Functions | |
NodeRespecterLayout () | |
Creates an instance of the NodeRespecterLayout. More... | |
~NodeRespecterLayout () | |
Destroys an instance of the NodeRespecterLayout. More... | |
virtual void | call (GraphAttributes &attr) override |
Calls the layout algorithm for the GraphAttributes attr . More... | |
Setters for Algorithm Parameters | |
void | setRandomInitialPlacement (bool randomInitialPlacement) |
Sets m_randomInitialPlacement to randomInitialPlacement . More... | |
void | setPostProcessing (PostProcessingMode postProcessing) |
Sets m_postProcessing to postProcessing . More... | |
void | setBendNormalizationAngle (double bendNormalizationAngle) |
Sets m_bendNormalizationAngle to bendNormalizationAngle in [0...Pi]. More... | |
void | setNumberOfIterations (int numberOfIterations) |
Sets m_numberOfIterations to numberOfIterations >= 0. More... | |
void | setMinimalTemperature (double minimalTemperature) |
Sets m_minimalTemperature to minimalTemperature >= 0. More... | |
void | setInitialTemperature (double initialTemperature) |
Sets m_initialTemperature to initialTemperature > m_minimalTemperature. More... | |
void | setTemperatureDecreaseOffset (double temperatureDecreaseOffset) |
Sets m_temperatureDecreaseOffset to temperatureDecreaseOffset in [0...1]. More... | |
void | setGravitation (double gravitation) |
Sets m_gravitation to gravitation >= 0. More... | |
void | setOscillationAngle (double oscillationAngle) |
Sets m_oscillationAngle to oscillationAngle in [0...Pi]. More... | |
void | setDesiredMinEdgeLength (double desiredMinEdgeLength) |
Sets m_desiredMinEdgeLength to desiredMinEdgeLength > 0. More... | |
void | setInitDummiesPerEdge (int initDummiesPerEdge) |
Sets m_initDummiesPerEdge to initDummiesPerEdge >= 0. More... | |
void | setMaxDummiesPerEdge (int maxDummiesPerEdge) |
Sets m_maxDummiesPerEdge to maxDummiesPerEdge > m_initDummiesPerEdge. More... | |
void | setDummyInsertionThreshold (double dummyInsertionThreshold) |
Sets m_dummyInsertionThreshold to dummyInsertionThreshold >= 1. More... | |
void | setMaxDisturbance (double maxDisturbance) |
Sets m_maxDisturbance to maxDisturbance >= 0. More... | |
void | setRepulsionDistance (double repulsionDistance) |
Sets m_repulsionDistance to repulsionDistance >= 0. More... | |
void | setMinDistCC (double minDistCC) |
Sets m_minDistCC to minDistCC >= 0. More... | |
void | setPageRatio (double pageRatio) |
Sets m_pageRatio to pageRatio > 0. More... | |
Getters for Algorithm Parameters | |
bool | getRandomInitialPlacement () const |
Returns m_randomInitialPlacement. More... | |
PostProcessingMode | getPostProcessing () const |
Returns m_postProcessing. More... | |
double | getBendNormalizationAngle () const |
Returns m_bendNormalizationAngle. More... | |
int | getNumberOfIterations () const |
Returns m_numberOfIterations. More... | |
double | getMinimalTemperature () const |
Returns m_minimalTemperature. More... | |
double | getInitialTemperature () const |
Returns m_initialTemperature. More... | |
double | getTemperatureDecreaseOffset () const |
Returns m_temperatureDecreaseOffset. More... | |
double | getGravitation () const |
Returns m_gravitation. More... | |
double | getOscillationAngle () const |
Returns m_oscillationAngle. More... | |
double | getDesiredMinEdgeLength () const |
Returns m_desiredMinEdgeLength. More... | |
int | getInitDummiesPerEdge () const |
Returns m_initDummiesPerEdge. More... | |
int | getMaxDummiesPerEdge () const |
Returns m_maxDummiesPerEdge. More... | |
double | getDummyInsertionThreshold () const |
Returns m_dummyInsertionThreshold. More... | |
double | getMaxDisturbance () const |
Returns m_maxDisturbance. More... | |
double | getRepulsionDistance () const |
Returns m_repulsionDistance. More... | |
double | getMinDistCC () const |
Returns m_minDistCC. More... | |
double | getPageRatio () const |
Returns m_pageRatio. More... | |
![]() | |
LayoutModule () | |
Initializes a layout module. More... | |
virtual | ~LayoutModule () |
void | operator() (GraphAttributes &GA) |
Computes a layout of graph GA . More... | |
Private Member Functions | |
void | addDummies (node v, SListPure< node > &nodes) |
Adds dummy nodes to incident edges of v if they are too long. More... | |
std::pair< double, double > | computeImpulse (node v) |
Returns the new impulse for node v . More... | |
void | createBends (const ArrayBuffer< edge > &origEdges, GraphAttributes &attr) |
Creates bends in attr at the coordinates of dummy nodes in copy . More... | |
void | freeData () |
Frees all graph data used by the algorithm. More... | |
bool | haveSameOriginalEdge (node v, node w) const |
Returns whether v and w belong to the same original edge. If only one of the nodes is a dummy node, returns whether its original edge is incident to the other node. If none of the nodes is a dummy node, returns false. More... | |
void | initData () |
Initializes all graph data used by the algorithm. More... | |
double | radius (const GraphAttributes &attr, node v) const |
Returns the radius of the smallest circle surrounding the shape of v (while still having its center at the position of v ). More... | |
void | updateNode (node v, std::pair< double, double > newImpulse) |
Updates the node data for node v using newImpulse as the x- and y-coordinate of the new impulse onto v . More... | |
void | updateNodeLoop (SListPure< node > &nodes) |
Computes new impulses and updates positions for random permutations of nodes until m_numberOfIterations iterations are over or m_globalTemperature drops below m_minimalTemperature. More... | |
double | weight (node v) const |
Returns the weight of node v according to its degree. More... | |
Private Attributes | |
Algorithm Parameters | |
bool | m_randomInitialPlacement |
Whether nodes should be initialized in random positions. More... | |
PostProcessingMode | m_postProcessing |
Whether unnecessary bends should be filtered out in a post processing step. More... | |
double | m_bendNormalizationAngle |
Lower bound for the minimum angle between two line segments such that the bend point between them is still removed. More... | |
int | m_numberOfIterations |
Number of times a single node is moved for each connected component. More... | |
double | m_minimalTemperature |
Minimal temperature, lower bound for the global temperature. More... | |
double | m_initialTemperature |
Initial temperature of every node. More... | |
double | m_temperatureDecreaseOffset |
Factor for which holds: If only m_numberOfIterations * m_temperatureDecreaseOffset iterations are left, the global temperature starts to be decreased linearly. More... | |
double | m_gravitation |
Gravitational constant scaling attractive forces towards the barycenter. More... | |
double | m_oscillationAngle |
Maximum angle between new and previous impulse such that the node movement is counted as an oscillation. More... | |
double | m_desiredMinEdgeLength |
Desired minimal node separation/edge length. More... | |
int | m_initDummiesPerEdge |
How many dummy nodes should initially be created for one edge. More... | |
int | m_maxDummiesPerEdge |
How many dummy nodes should maximally be created for one edge. More... | |
double | m_dummyInsertionThreshold |
How many times larger than the desired edge length an edge has to be in order for a new dummy node to be created by splitting said edge. More... | |
double | m_maxDisturbance |
Maximal disturbance, i.e. maximal random node movement. More... | |
double | m_repulsionDistance |
Maximum distance between a dummy and another node such that the former is repulsed by the latter. More... | |
double | m_minDistCC |
Minimal distance between connected components. More... | |
double | m_pageRatio |
Page ratio used for the layout of connected components. More... | |
Graph Data Used by the Algorithm | |
GraphCopy | m_copy |
Copy of the given graph which may contain dummy nodes. More... | |
GraphAttributes | m_copyAttr |
GraphAttributes for m_copy. 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... | |
NodeArray< double > | m_localTemperature |
Local temperature of the node. More... | |
NodeArray< double > | m_nodeRadius |
Radius of the smallest circle encompassing the node. More... | |
EdgeArray< bool > | m_hasParEdges |
Whether the edge has parallel edges. More... | |
NodeArray< NodeArray< double > > | m_desiredDistance |
Desired distance between each pair of nodes. More... | |
Other Data Used by the Algorithm | |
int | m_degreeSum |
Twice the number of all edges in the original graph. 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... | |
int | m_iterCounter |
Number of iterations for which the algorithm still has to run. More... | |
double | m_globalTemperature |
Average of all local node temperatures. More... | |
double | m_factor |
Precomputed constant used to get the max. temperature for each iteration. More... | |
double | m_cos |
Precomputed cosinus of (m_oscillationAngle / 2). More... | |
The NodeRespecterLayout layout algorithm.
This is a force-directed layout algorithm respecting the shapes and sizes of nodes. It aims to minimize the number of node overlaps as well as the number of edges crossing through non-incident nodes. In order to achieve this, the algorithm adapts its forces to the node sizes and bends edges around close-by nodes. The edge bends are created by introducing dummy nodes into the graph, positioning all nodes according to forces acting upon them, filtering out unnecessary dummy nodes, and then replacing the remaining dummy nodes by edge bends.
The algorithm is documented in and was developed for the bachelor thesis: Max Ilsen: Energy-Based Layout Algorithms for Graphs with Large Nodes. University of Osnabrueck, 2017
The following parameters can be set:
Definition at line 85 of file NodeRespecterLayout.h.
|
strong |
Sets whether unnecessary edge bends should be filtered out in a post-processing step.
Definition at line 100 of file NodeRespecterLayout.h.
ogdf::NodeRespecterLayout::NodeRespecterLayout | ( | ) |
Creates an instance of the NodeRespecterLayout.
|
inline |
Destroys an instance of the NodeRespecterLayout.
Definition at line 93 of file NodeRespecterLayout.h.
Adds dummy nodes to incident edges of v
if they are too long.
|
overridevirtual |
Calls the layout algorithm for the GraphAttributes attr
.
Implements ogdf::LayoutModule.
|
private |
Returns the new impulse for node v
.
|
private |
Creates bends in attr
at the coordinates of dummy nodes in copy
.
|
private |
Frees all graph data used by the algorithm.
|
inline |
Returns m_bendNormalizationAngle.
Definition at line 177 of file NodeRespecterLayout.h.
|
inline |
Returns m_desiredMinEdgeLength.
Definition at line 198 of file NodeRespecterLayout.h.
|
inline |
Returns m_dummyInsertionThreshold.
Definition at line 207 of file NodeRespecterLayout.h.
|
inline |
Returns m_gravitation.
Definition at line 192 of file NodeRespecterLayout.h.
|
inline |
Returns m_initDummiesPerEdge.
Definition at line 201 of file NodeRespecterLayout.h.
|
inline |
Returns m_initialTemperature.
Definition at line 186 of file NodeRespecterLayout.h.
|
inline |
Returns m_maxDisturbance.
Definition at line 210 of file NodeRespecterLayout.h.
|
inline |
Returns m_maxDummiesPerEdge.
Definition at line 204 of file NodeRespecterLayout.h.
|
inline |
Returns m_minDistCC.
Definition at line 216 of file NodeRespecterLayout.h.
|
inline |
Returns m_minimalTemperature.
Definition at line 183 of file NodeRespecterLayout.h.
|
inline |
Returns m_numberOfIterations.
Definition at line 180 of file NodeRespecterLayout.h.
|
inline |
Returns m_oscillationAngle.
Definition at line 195 of file NodeRespecterLayout.h.
|
inline |
Returns m_pageRatio.
Definition at line 219 of file NodeRespecterLayout.h.
|
inline |
Returns m_postProcessing.
Definition at line 174 of file NodeRespecterLayout.h.
|
inline |
Returns m_randomInitialPlacement.
Definition at line 171 of file NodeRespecterLayout.h.
|
inline |
Returns m_repulsionDistance.
Definition at line 213 of file NodeRespecterLayout.h.
|
inline |
Returns m_temperatureDecreaseOffset.
Definition at line 189 of file NodeRespecterLayout.h.
Returns whether v
and w
belong to the same original edge. If only one of the nodes is a dummy node, returns whether its original edge is incident to the other node. If none of the nodes is a dummy node, returns false.
Definition at line 385 of file NodeRespecterLayout.h.
|
private |
Initializes all graph data used by the algorithm.
|
inlineprivate |
Returns the radius of the smallest circle surrounding the shape of v
(while still having its center at the position of v
).
Definition at line 365 of file NodeRespecterLayout.h.
void ogdf::NodeRespecterLayout::setBendNormalizationAngle | ( | double | bendNormalizationAngle | ) |
Sets m_bendNormalizationAngle to bendNormalizationAngle
in [0...Pi].
void ogdf::NodeRespecterLayout::setDesiredMinEdgeLength | ( | double | desiredMinEdgeLength | ) |
Sets m_desiredMinEdgeLength to desiredMinEdgeLength
> 0.
void ogdf::NodeRespecterLayout::setDummyInsertionThreshold | ( | double | dummyInsertionThreshold | ) |
Sets m_dummyInsertionThreshold to dummyInsertionThreshold
>= 1.
void ogdf::NodeRespecterLayout::setGravitation | ( | double | gravitation | ) |
Sets m_gravitation to gravitation
>= 0.
void ogdf::NodeRespecterLayout::setInitDummiesPerEdge | ( | int | initDummiesPerEdge | ) |
Sets m_initDummiesPerEdge to initDummiesPerEdge
>= 0.
void ogdf::NodeRespecterLayout::setInitialTemperature | ( | double | initialTemperature | ) |
Sets m_initialTemperature to initialTemperature
> m_minimalTemperature.
void ogdf::NodeRespecterLayout::setMaxDisturbance | ( | double | maxDisturbance | ) |
Sets m_maxDisturbance to maxDisturbance
>= 0.
void ogdf::NodeRespecterLayout::setMaxDummiesPerEdge | ( | int | maxDummiesPerEdge | ) |
Sets m_maxDummiesPerEdge to maxDummiesPerEdge
> m_initDummiesPerEdge.
void ogdf::NodeRespecterLayout::setMinDistCC | ( | double | minDistCC | ) |
Sets m_minDistCC to minDistCC
>= 0.
void ogdf::NodeRespecterLayout::setMinimalTemperature | ( | double | minimalTemperature | ) |
Sets m_minimalTemperature to minimalTemperature
>= 0.
void ogdf::NodeRespecterLayout::setNumberOfIterations | ( | int | numberOfIterations | ) |
Sets m_numberOfIterations to numberOfIterations
>= 0.
void ogdf::NodeRespecterLayout::setOscillationAngle | ( | double | oscillationAngle | ) |
Sets m_oscillationAngle to oscillationAngle
in [0...Pi].
void ogdf::NodeRespecterLayout::setPageRatio | ( | double | pageRatio | ) |
Sets m_pageRatio to pageRatio
> 0.
void ogdf::NodeRespecterLayout::setPostProcessing | ( | PostProcessingMode | postProcessing | ) |
Sets m_postProcessing to postProcessing
.
void ogdf::NodeRespecterLayout::setRandomInitialPlacement | ( | bool | randomInitialPlacement | ) |
Sets m_randomInitialPlacement to randomInitialPlacement
.
void ogdf::NodeRespecterLayout::setRepulsionDistance | ( | double | repulsionDistance | ) |
Sets m_repulsionDistance to repulsionDistance
>= 0.
void ogdf::NodeRespecterLayout::setTemperatureDecreaseOffset | ( | double | temperatureDecreaseOffset | ) |
Sets m_temperatureDecreaseOffset to temperatureDecreaseOffset
in [0...1].
|
private |
Updates the node data for node v
using newImpulse
as the x- and y-coordinate of the new impulse onto v
.
Computes new impulses and updates positions for random permutations of nodes
until m_numberOfIterations iterations are over or m_globalTemperature drops below m_minimalTemperature.
|
inlineprivate |
Returns the weight of node v
according to its degree.
Definition at line 399 of file NodeRespecterLayout.h.
|
private |
Weighted sum of x-coordinates of all nodes.
Definition at line 320 of file NodeRespecterLayout.h.
|
private |
Weighted sum of y-coordinates of all nodes.
Definition at line 323 of file NodeRespecterLayout.h.
|
private |
Lower bound for the minimum angle between two line segments such that the bend point between them is still removed.
Definition at line 235 of file NodeRespecterLayout.h.
|
private |
Copy of the given graph which may contain dummy nodes.
Definition at line 289 of file NodeRespecterLayout.h.
|
private |
GraphAttributes for m_copy.
Definition at line 292 of file NodeRespecterLayout.h.
|
private |
Precomputed cosinus of (m_oscillationAngle / 2).
Definition at line 335 of file NodeRespecterLayout.h.
|
private |
Twice the number of all edges in the original graph.
Definition at line 317 of file NodeRespecterLayout.h.
Desired distance between each pair of nodes.
Definition at line 310 of file NodeRespecterLayout.h.
|
private |
Desired minimal node separation/edge length.
Definition at line 259 of file NodeRespecterLayout.h.
|
private |
How many times larger than the desired edge length an edge has to be in order for a new dummy node to be created by splitting said edge.
Definition at line 269 of file NodeRespecterLayout.h.
|
private |
Precomputed constant used to get the max. temperature for each iteration.
Definition at line 332 of file NodeRespecterLayout.h.
|
private |
Average of all local node temperatures.
Definition at line 329 of file NodeRespecterLayout.h.
|
private |
Gravitational constant scaling attractive forces towards the barycenter.
Definition at line 252 of file NodeRespecterLayout.h.
|
private |
Whether the edge has parallel edges.
Definition at line 307 of file NodeRespecterLayout.h.
|
private |
X-coordinate of the last impulse of the node.
Definition at line 295 of file NodeRespecterLayout.h.
|
private |
Y-coordinate of the last impulse of the node.
Definition at line 298 of file NodeRespecterLayout.h.
|
private |
How many dummy nodes should initially be created for one edge.
Definition at line 262 of file NodeRespecterLayout.h.
|
private |
Initial temperature of every node.
Definition at line 244 of file NodeRespecterLayout.h.
|
private |
Number of iterations for which the algorithm still has to run.
Definition at line 326 of file NodeRespecterLayout.h.
|
private |
Local temperature of the node.
Definition at line 301 of file NodeRespecterLayout.h.
|
private |
Maximal disturbance, i.e. maximal random node movement.
Definition at line 272 of file NodeRespecterLayout.h.
|
private |
How many dummy nodes should maximally be created for one edge.
Definition at line 265 of file NodeRespecterLayout.h.
|
private |
Minimal distance between connected components.
Definition at line 279 of file NodeRespecterLayout.h.
|
private |
Minimal temperature, lower bound for the global temperature.
Definition at line 241 of file NodeRespecterLayout.h.
|
private |
Radius of the smallest circle encompassing the node.
Definition at line 304 of file NodeRespecterLayout.h.
|
private |
Number of times a single node is moved for each connected component.
Definition at line 238 of file NodeRespecterLayout.h.
|
private |
Maximum angle between new and previous impulse such that the node movement is counted as an oscillation.
Definition at line 256 of file NodeRespecterLayout.h.
|
private |
Page ratio used for the layout of connected components.
Definition at line 282 of file NodeRespecterLayout.h.
|
private |
Whether unnecessary bends should be filtered out in a post processing step.
Definition at line 231 of file NodeRespecterLayout.h.
|
private |
Whether nodes should be initialized in random positions.
Definition at line 228 of file NodeRespecterLayout.h.
|
private |
Maximum distance between a dummy and another node such that the former is repulsed by the latter.
Definition at line 276 of file NodeRespecterLayout.h.
|
private |
Factor for which holds: If only m_numberOfIterations * m_temperatureDecreaseOffset iterations are left, the global temperature starts to be decreased linearly.
Definition at line 249 of file NodeRespecterLayout.h.