The NodeRespecterLayout layout algorithm. More...
#include <ogdf/energybased/NodeRespecterLayout.h>
Public Types | |
enum class | PostProcessingMode { None , KeepMultiEdgeBends , Complete } |
Sets whether unnecessary edge bends should be filtered out in a post-processing step. More... | |
Private Member Functions | |
void | addDummies (node v, SListPure< node > &nodes) |
Adds dummy nodes to incident edges of v if they are too long. | |
std::pair< double, double > | computeImpulse (node v) |
Returns the new impulse for node v . | |
void | createBends (const ArrayBuffer< edge > &origEdges, GraphAttributes &attr) |
Creates bends in attr at the coordinates of dummy nodes in copy . | |
void | freeData () |
Frees all graph data used by the algorithm. | |
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. | |
void | initData () |
Initializes all graph data used by the algorithm. | |
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 ). | |
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 . | |
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. | |
double | weight (node v) const |
Returns the weight of node v according to its degree. | |
Private Attributes | |
Algorithm Parameters | |
bool | m_randomInitialPlacement |
Whether nodes should be initialized in random positions. | |
PostProcessingMode | m_postProcessing |
Whether unnecessary bends should be filtered out in a post processing step. | |
double | m_bendNormalizationAngle |
Lower bound for the minimum angle between two line segments such that the bend point between them is still removed. | |
int | m_numberOfIterations |
Number of times a single node is moved for each connected component. | |
double | m_minimalTemperature |
Minimal temperature, lower bound for the global temperature. | |
double | m_initialTemperature |
Initial temperature of every node. | |
double | m_temperatureDecreaseOffset |
Factor for which holds: If only m_numberOfIterations * m_temperatureDecreaseOffset iterations are left, the global temperature starts to be decreased linearly. | |
double | m_gravitation |
Gravitational constant scaling attractive forces towards the barycenter. | |
double | m_oscillationAngle |
Maximum angle between new and previous impulse such that the node movement is counted as an oscillation. | |
double | m_desiredMinEdgeLength |
Desired minimal node separation/edge length. | |
int | m_initDummiesPerEdge |
How many dummy nodes should initially be created for one edge. | |
int | m_maxDummiesPerEdge |
How many dummy nodes should maximally be created for one edge. | |
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. | |
double | m_maxDisturbance |
Maximal disturbance, i.e. maximal random node movement. | |
double | m_repulsionDistance |
Maximum distance between a dummy and another node such that the former is repulsed by the latter. | |
double | m_minDistCC |
Minimal distance between connected components. | |
double | m_pageRatio |
Page ratio used for the layout of connected components. | |
Graph Data Used by the Algorithm | |
GraphCopy | m_copy |
Copy of the given graph which may contain dummy nodes. | |
GraphAttributes | m_copyAttr |
GraphAttributes for m_copy. | |
NodeArray< double > | m_impulseX |
X-coordinate of the last impulse of the node. | |
NodeArray< double > | m_impulseY |
Y-coordinate of the last impulse of the node. | |
NodeArray< double > | m_localTemperature |
Local temperature of the node. | |
NodeArray< double > | m_nodeRadius |
Radius of the smallest circle encompassing the node. | |
EdgeArray< bool > | m_hasParEdges |
Whether the edge has parallel edges. | |
NodeArray< NodeArray< double > > | m_desiredDistance |
Desired distance between each pair of nodes. | |
Other Data Used by the Algorithm | |
int | m_degreeSum |
Twice the number of all edges in the original graph. | |
double | m_barycenterX |
Weighted sum of x-coordinates of all nodes. | |
double | m_barycenterY |
Weighted sum of y-coordinates of all nodes. | |
int | m_iterCounter |
Number of iterations for which the algorithm still has to run. | |
double | m_globalTemperature |
Average of all local node temperatures. | |
double | m_factor |
Precomputed constant used to get the max. temperature for each iteration. | |
double | m_cos |
Precomputed cosinus of (m_oscillationAngle / 2). | |
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.
Sets whether unnecessary edge bends should be filtered out in a post-processing step.
Definition at line 98 of file NodeRespecterLayout.h.
ogdf::NodeRespecterLayout::NodeRespecterLayout | ( | ) |
Creates an instance of the NodeRespecterLayout.
|
inline |
Destroys an instance of the NodeRespecterLayout.
Definition at line 91 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.
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 175 of file NodeRespecterLayout.h.
|
inline |
Returns m_desiredMinEdgeLength.
Definition at line 196 of file NodeRespecterLayout.h.
|
inline |
Returns m_dummyInsertionThreshold.
Definition at line 205 of file NodeRespecterLayout.h.
|
inline |
Returns m_gravitation.
Definition at line 190 of file NodeRespecterLayout.h.
|
inline |
Returns m_initDummiesPerEdge.
Definition at line 199 of file NodeRespecterLayout.h.
|
inline |
Returns m_initialTemperature.
Definition at line 184 of file NodeRespecterLayout.h.
|
inline |
Returns m_maxDisturbance.
Definition at line 208 of file NodeRespecterLayout.h.
|
inline |
Returns m_maxDummiesPerEdge.
Definition at line 202 of file NodeRespecterLayout.h.
|
inline |
Returns m_minDistCC.
Definition at line 214 of file NodeRespecterLayout.h.
|
inline |
Returns m_minimalTemperature.
Definition at line 181 of file NodeRespecterLayout.h.
|
inline |
Returns m_numberOfIterations.
Definition at line 178 of file NodeRespecterLayout.h.
|
inline |
Returns m_oscillationAngle.
Definition at line 193 of file NodeRespecterLayout.h.
|
inline |
Returns m_pageRatio.
Definition at line 217 of file NodeRespecterLayout.h.
|
inline |
Returns m_postProcessing.
Definition at line 172 of file NodeRespecterLayout.h.
|
inline |
Returns m_randomInitialPlacement.
Definition at line 169 of file NodeRespecterLayout.h.
|
inline |
Returns m_repulsionDistance.
Definition at line 211 of file NodeRespecterLayout.h.
|
inline |
Returns m_temperatureDecreaseOffset.
Definition at line 187 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 383 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 363 of file NodeRespecterLayout.h.
Sets m_bendNormalizationAngle to bendNormalizationAngle
in [0...Pi].
Sets m_desiredMinEdgeLength to desiredMinEdgeLength
> 0.
Sets m_dummyInsertionThreshold to dummyInsertionThreshold
>= 1.
Sets m_gravitation to gravitation
>= 0.
Sets m_initDummiesPerEdge to initDummiesPerEdge
>= 0.
Sets m_initialTemperature to initialTemperature
> m_minimalTemperature.
Sets m_maxDisturbance to maxDisturbance
>= 0.
Sets m_maxDummiesPerEdge to maxDummiesPerEdge
> m_initDummiesPerEdge.
Sets m_minDistCC to minDistCC
>= 0.
Sets m_minimalTemperature to minimalTemperature
>= 0.
Sets m_numberOfIterations to numberOfIterations
>= 0.
Sets m_oscillationAngle to oscillationAngle
in [0...Pi].
Sets m_pageRatio to pageRatio
> 0.
void ogdf::NodeRespecterLayout::setPostProcessing | ( | PostProcessingMode | postProcessing | ) |
Sets m_postProcessing to postProcessing
.
Sets m_randomInitialPlacement to randomInitialPlacement
.
Sets m_repulsionDistance to repulsionDistance
>= 0.
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.
Returns the weight of node v
according to its degree.
Definition at line 397 of file NodeRespecterLayout.h.
|
private |
Weighted sum of x-coordinates of all nodes.
Definition at line 318 of file NodeRespecterLayout.h.
|
private |
Weighted sum of y-coordinates of all nodes.
Definition at line 321 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 233 of file NodeRespecterLayout.h.
|
private |
Copy of the given graph which may contain dummy nodes.
Definition at line 287 of file NodeRespecterLayout.h.
|
private |
GraphAttributes for m_copy.
Definition at line 290 of file NodeRespecterLayout.h.
|
private |
Precomputed cosinus of (m_oscillationAngle / 2).
Definition at line 333 of file NodeRespecterLayout.h.
|
private |
Twice the number of all edges in the original graph.
Definition at line 315 of file NodeRespecterLayout.h.
Desired distance between each pair of nodes.
Definition at line 308 of file NodeRespecterLayout.h.
|
private |
Desired minimal node separation/edge length.
Definition at line 257 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 267 of file NodeRespecterLayout.h.
|
private |
Precomputed constant used to get the max. temperature for each iteration.
Definition at line 330 of file NodeRespecterLayout.h.
|
private |
Average of all local node temperatures.
Definition at line 327 of file NodeRespecterLayout.h.
|
private |
Gravitational constant scaling attractive forces towards the barycenter.
Definition at line 250 of file NodeRespecterLayout.h.
Whether the edge has parallel edges.
Definition at line 305 of file NodeRespecterLayout.h.
X-coordinate of the last impulse of the node.
Definition at line 293 of file NodeRespecterLayout.h.
Y-coordinate of the last impulse of the node.
Definition at line 296 of file NodeRespecterLayout.h.
|
private |
How many dummy nodes should initially be created for one edge.
Definition at line 260 of file NodeRespecterLayout.h.
|
private |
Initial temperature of every node.
Definition at line 242 of file NodeRespecterLayout.h.
|
private |
Number of iterations for which the algorithm still has to run.
Definition at line 324 of file NodeRespecterLayout.h.
Local temperature of the node.
Definition at line 299 of file NodeRespecterLayout.h.
|
private |
Maximal disturbance, i.e. maximal random node movement.
Definition at line 270 of file NodeRespecterLayout.h.
|
private |
How many dummy nodes should maximally be created for one edge.
Definition at line 263 of file NodeRespecterLayout.h.
|
private |
Minimal distance between connected components.
Definition at line 277 of file NodeRespecterLayout.h.
|
private |
Minimal temperature, lower bound for the global temperature.
Definition at line 239 of file NodeRespecterLayout.h.
Radius of the smallest circle encompassing the node.
Definition at line 302 of file NodeRespecterLayout.h.
|
private |
Number of times a single node is moved for each connected component.
Definition at line 236 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 254 of file NodeRespecterLayout.h.
|
private |
Page ratio used for the layout of connected components.
Definition at line 280 of file NodeRespecterLayout.h.
|
private |
Whether unnecessary bends should be filtered out in a post processing step.
Definition at line 229 of file NodeRespecterLayout.h.
|
private |
Whether nodes should be initialized in random positions.
Definition at line 226 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 274 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 247 of file NodeRespecterLayout.h.