Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

The LP-based hierarchy layout algorithm. More...

#include <ogdf/layered/OptimalHierarchyLayout.h>

+ Inheritance diagram for ogdf::OptimalHierarchyLayout:

Public Member Functions

 OptimalHierarchyLayout ()
 Creates an instance of optimal hierarchy layout. More...
 
 OptimalHierarchyLayout (const OptimalHierarchyLayout &)
 Copy constructor. More...
 
 ~OptimalHierarchyLayout ()
 
OptimalHierarchyLayoutoperator= (const OptimalHierarchyLayout &)
 Assignment operator. More...
 
Optional parameters
double nodeDistance () const
 Returns the minimal allowed x-distance between nodes on a layer. More...
 
void nodeDistance (double x)
 Sets the minimal allowed x-distance between nodes on a layer to x. More...
 
double layerDistance () const
 Returns the minimal allowed y-distance between layers. More...
 
void layerDistance (double x)
 Sets the minimal allowed y-distance between layers to x. More...
 
bool fixedLayerDistance () const
 Returns the current setting of option fixedLayerDistance. More...
 
void fixedLayerDistance (bool b)
 Sets the option fixedLayerDistance to b. More...
 
double weightSegments () const
 Returns the weight of edge segments connecting to vertical segments. More...
 
void weightSegments (double w)
 Sets the weight of edge segments connecting to vertical segments to w. More...
 
double weightBalancing () const
 Returns the weight for balancing successors below a node; 0.0 means no balancing. More...
 
void weightBalancing (double w)
 Sets the weight for balancing successors below a node to w; 0.0 means no balancing. More...
 
- Public Member Functions inherited from ogdf::HierarchyLayoutModule
 HierarchyLayoutModule ()
 Initializes a hierarchy layout module. More...
 
virtual ~HierarchyLayoutModule ()
 
void call (const HierarchyLevelsBase &levels, GraphAttributes &GA)
 Computes a hierarchy layout of levels in GA. More...
 

Protected Member Functions

virtual void doCall (const HierarchyLevelsBase &levels, GraphAttributes &AGC) override
 Implements the algorithm call. More...
 

Private Member Functions

void computeXCoordinates (const HierarchyLevelsBase &levels, GraphAttributes &AGC)
 
void computeYCoordinates (const HierarchyLevelsBase &levels, GraphAttributes &AGC)
 

Private Attributes

bool m_fixedLayerDistance
 Use fixed layer distances? More...
 
double m_layerDistance
 The minimal distance between layers. More...
 
double m_nodeDistance
 The minimal distance between nodes. More...
 
double m_weightBalancing
 The weight for balancing. More...
 
double m_weightSegments
 The weight of edge segments. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ogdf::HierarchyLayoutModule
static void dynLayerDistance (GraphAttributes &AGC, HierarchyLevelsBase &levels)
 
- Static Protected Member Functions inherited from ogdf::HierarchyLayoutModule
static double getHeight (const GraphAttributes &GA, const HierarchyLevelsBase &levels, node v)
 Returns the GA height of node v or 0 if it is a dummy node in the hierarchy of levels. More...
 
static double getWidth (const GraphAttributes &GA, const HierarchyLevelsBase &levels, node v)
 Returns the GA width of node v or 0 if it is a dummy node in the hierarchy of levels. More...
 

Detailed Description

The LP-based hierarchy layout algorithm.

OptimalHierarchyLayout implements a hierarchy layout algorithm that is based on an LP-formulation. It is only available if OGDF is compiled with LP-solver support (e.g., Coin).

The used model avoids Spaghetti-effect like routing of edges by using long vertical segments as in FastHierarchyLayout. An additional balancing can be used which balances the successors below a node.

Optional parameters

OptionTypeDefaultDescription
nodeDistancedouble3.0 The minimal allowed x-distance between nodes on a layer.
layerDistancedouble3.0 The minimal allowed y-distance between layers.
fixedLayerDistanceboolfalse If set to true, the distance between neighboured layers is always layerDistance; otherwise the distance is adjusted (increased) to improve readability.
weightSegmentsdouble2.0 The weight of edge segments connecting to vertical segments.
weightBalancingdouble0.1 The weight for balancing successors below a node; 0.0 means no balancing.

Definition at line 76 of file OptimalHierarchyLayout.h.

Constructor & Destructor Documentation

◆ OptimalHierarchyLayout() [1/2]

ogdf::OptimalHierarchyLayout::OptimalHierarchyLayout ( )

Creates an instance of optimal hierarchy layout.

◆ OptimalHierarchyLayout() [2/2]

ogdf::OptimalHierarchyLayout::OptimalHierarchyLayout ( const OptimalHierarchyLayout )

Copy constructor.

◆ ~OptimalHierarchyLayout()

ogdf::OptimalHierarchyLayout::~OptimalHierarchyLayout ( )
inline

Definition at line 86 of file OptimalHierarchyLayout.h.

Member Function Documentation

◆ computeXCoordinates()

void ogdf::OptimalHierarchyLayout::computeXCoordinates ( const HierarchyLevelsBase levels,
GraphAttributes AGC 
)
private

◆ computeYCoordinates()

void ogdf::OptimalHierarchyLayout::computeYCoordinates ( const HierarchyLevelsBase levels,
GraphAttributes AGC 
)
private

◆ doCall()

virtual void ogdf::OptimalHierarchyLayout::doCall ( const HierarchyLevelsBase levels,
GraphAttributes AGC 
)
overrideprotectedvirtual

Implements the algorithm call.

Implements ogdf::HierarchyLayoutModule.

◆ fixedLayerDistance() [1/2]

bool ogdf::OptimalHierarchyLayout::fixedLayerDistance ( ) const
inline

Returns the current setting of option fixedLayerDistance.

If set to true, the distance is always layerDistance; otherwise the distance is adjusted (increased) to improve readability.

Definition at line 125 of file OptimalHierarchyLayout.h.

◆ fixedLayerDistance() [2/2]

void ogdf::OptimalHierarchyLayout::fixedLayerDistance ( bool  b)
inline

Sets the option fixedLayerDistance to b.

Definition at line 130 of file OptimalHierarchyLayout.h.

◆ layerDistance() [1/2]

double ogdf::OptimalHierarchyLayout::layerDistance ( ) const
inline

Returns the minimal allowed y-distance between layers.

Definition at line 110 of file OptimalHierarchyLayout.h.

◆ layerDistance() [2/2]

void ogdf::OptimalHierarchyLayout::layerDistance ( double  x)
inline

Sets the minimal allowed y-distance between layers to x.

Definition at line 115 of file OptimalHierarchyLayout.h.

◆ nodeDistance() [1/2]

double ogdf::OptimalHierarchyLayout::nodeDistance ( ) const
inline

Returns the minimal allowed x-distance between nodes on a layer.

Definition at line 99 of file OptimalHierarchyLayout.h.

◆ nodeDistance() [2/2]

void ogdf::OptimalHierarchyLayout::nodeDistance ( double  x)
inline

Sets the minimal allowed x-distance between nodes on a layer to x.

Definition at line 104 of file OptimalHierarchyLayout.h.

◆ operator=()

OptimalHierarchyLayout& ogdf::OptimalHierarchyLayout::operator= ( const OptimalHierarchyLayout )

Assignment operator.

◆ weightBalancing() [1/2]

double ogdf::OptimalHierarchyLayout::weightBalancing ( ) const
inline

Returns the weight for balancing successors below a node; 0.0 means no balancing.

Definition at line 146 of file OptimalHierarchyLayout.h.

◆ weightBalancing() [2/2]

void ogdf::OptimalHierarchyLayout::weightBalancing ( double  w)
inline

Sets the weight for balancing successors below a node to w; 0.0 means no balancing.

Definition at line 151 of file OptimalHierarchyLayout.h.

◆ weightSegments() [1/2]

double ogdf::OptimalHierarchyLayout::weightSegments ( ) const
inline

Returns the weight of edge segments connecting to vertical segments.

Definition at line 135 of file OptimalHierarchyLayout.h.

◆ weightSegments() [2/2]

void ogdf::OptimalHierarchyLayout::weightSegments ( double  w)
inline

Sets the weight of edge segments connecting to vertical segments to w.

Definition at line 140 of file OptimalHierarchyLayout.h.

Member Data Documentation

◆ m_fixedLayerDistance

bool ogdf::OptimalHierarchyLayout::m_fixedLayerDistance
private

Use fixed layer distances?

Definition at line 173 of file OptimalHierarchyLayout.h.

◆ m_layerDistance

double ogdf::OptimalHierarchyLayout::m_layerDistance
private

The minimal distance between layers.

Definition at line 172 of file OptimalHierarchyLayout.h.

◆ m_nodeDistance

double ogdf::OptimalHierarchyLayout::m_nodeDistance
private

The minimal distance between nodes.

Definition at line 171 of file OptimalHierarchyLayout.h.

◆ m_weightBalancing

double ogdf::OptimalHierarchyLayout::m_weightBalancing
private

The weight for balancing.

Definition at line 176 of file OptimalHierarchyLayout.h.

◆ m_weightSegments

double ogdf::OptimalHierarchyLayout::m_weightSegments
private

The weight of edge segments.

Definition at line 175 of file OptimalHierarchyLayout.h.


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