Adaptagrams
Public Member Functions | List of all members
cola::ConstrainedMajorizationLayout Class Reference

Implements the Constrained Majorization graph layout algorithm (deprecated). More...

#include <cola.h>

Collaboration diagram for cola::ConstrainedMajorizationLayout:
Collaboration graph

Public Member Functions

 ConstrainedMajorizationLayout (vpsc::Rectangles &rs, std::vector< Edge > const &es, RootCluster *clusterHierarchy, const double idealLength, EdgeLengths eLengths=StandardEdgeLengths, TestConvergence *doneTest=nullptr, PreIteration *preIteration=nullptr, bool useNeighbourStress=false)
 Constructs a constrained majorization layout instance. More...
 
void setConstraints (cola::CompoundConstraints *ccs)
 Specify a set of compound constraints to apply to the layout. More...
 
void setUnsatisfiableConstraintInfo (UnsatisfiableConstraintInfos *unsatisfiableX, UnsatisfiableConstraintInfos *unsatisfiableY)
 Register to receive information about unsatisfiable constraints. More...
 
void setStickyNodes (const double stickyWeight, std::valarray< double > const &startX, std::valarray< double > const &startY)
 
void setScaling (bool scaling)
 
void setExternalSolver (bool externalSolver)
 
void setAvoidOverlaps (bool horizontal=false)
 
void setNonOverlappingClusters ()
 
void setStraightenEdges (std::vector< straightener::Edge *> *straightenEdges, double bendWeight=0.01, double potBendWeight=0.1, bool xSkipping=true)
 
void moveBoundingBoxes ()
 
void run (bool x=true, bool y=true)
 Implements the main layout loop, taking descent steps until stress is no-longer significantly reduced. More...
 
void runOnce (bool x=true, bool y=true)
 Same as run(), but only applies one iteration. More...
 

Detailed Description

Implements the Constrained Majorization graph layout algorithm (deprecated).

The optimisation method used is "stress majorization", where a sequence of quadratic functions which strictly bound the stress from above, is solved to monotonically reduce the stress (by iteratively changing the configuration of nodes).

Once the problem has been set up, call run() or runOnce() to run the layout algorithm.

Note
We recommend the use of ConstrainedFDLayout instead of this class. ConstrainedFDLayout tends to produce better results and has more features. We are no longer working on ConstrainedMajorizationLayout.

Constructor & Destructor Documentation

◆ ConstrainedMajorizationLayout()

cola::ConstrainedMajorizationLayout::ConstrainedMajorizationLayout ( vpsc::Rectangles rs,
std::vector< Edge > const &  es,
RootCluster clusterHierarchy,
const double  idealLength,
EdgeLengths  eLengths = StandardEdgeLengths,
TestConvergence doneTest = nullptr,
PreIteration preIteration = nullptr,
bool  useNeighbourStress = false 
)

Constructs a constrained majorization layout instance.

Parameters
[in]rsBounding boxes of nodes at their initial positions.
[in]esSimple pair edges, giving indices of the start and end nodes in rs.
[in]clusterHierarchyA pointer to a RootCluster object defining the cluster hierarchy (optional).
[in]idealLengthAa scalar modifier of ideal edge lengths in eLengths.
[in]eLengthsIndividual ideal lengths for edges. The actual ideal length used for the ith edge is idealLength*eLengths[i], or if eLengths is empty then just idealLength is used (i.e., eLengths[i] is assumed to be 1).
[in]doneA test of convergence operation called at the end of each iteration (optional).
[in]preIterationAn operation called before each iteration (optional).

Member Function Documentation

◆ moveBoundingBoxes()

void cola::ConstrainedMajorizationLayout::moveBoundingBoxes ( )
inline

Update position of bounding boxes.

◆ run()

void cola::ConstrainedMajorizationLayout::run ( bool  x = true,
bool  y = true 
)

Implements the main layout loop, taking descent steps until stress is no-longer significantly reduced.

Parameters
[in]xIf true, layout will be performed in x-dimension (default: true).
[in]yIf true, layout will be performed in y-dimension (default: true).

References vpsc::HORIZONTAL, setScaling(), and vpsc::VERTICAL.

Here is the call graph for this function:

◆ runOnce()

void cola::ConstrainedMajorizationLayout::runOnce ( bool  x = true,
bool  y = true 
)

Same as run(), but only applies one iteration.

This may be useful here it's too hard to implement a call-back (e.g., in java apps).

Parameters
[in]xIf true, layout will be performed in x-dimension (default: true).
[in]yIf true, layout will be performed in y-dimension (default: true).

References vpsc::HORIZONTAL, setScaling(), and vpsc::VERTICAL.

Here is the call graph for this function:

◆ setAvoidOverlaps()

void cola::ConstrainedMajorizationLayout::setAvoidOverlaps ( bool  horizontal = false)
inline

At each iteration of layout, generate constraints to avoid overlaps. If bool horizontal is true, all overlaps will be resolved horizontally, otherwise some overlaps will be left to be resolved vertically where doing so leads to less displacement

◆ setConstraints()

void cola::ConstrainedMajorizationLayout::setConstraints ( cola::CompoundConstraints ccs)
inline

Specify a set of compound constraints to apply to the layout.

Parameters
[in]ccsThe compound constraints.

◆ setExternalSolver()

void cola::ConstrainedMajorizationLayout::setExternalSolver ( bool  externalSolver)
inline

Says that the Mosek optimisation library should be used to solve the quadratic programs rather than the libvpsc solver.

◆ setNonOverlappingClusters()

void cola::ConstrainedMajorizationLayout::setNonOverlappingClusters ( )
inline

Add constraints to prevent clusters overlapping.

◆ setScaling()

void cola::ConstrainedMajorizationLayout::setScaling ( bool  scaling)
inline

Scaling speeds up the solver by conditioning the quadratic terms matrix.

Referenced by run(), and runOnce().

Here is the caller graph for this function:

◆ setStickyNodes()

void cola::ConstrainedMajorizationLayout::setStickyNodes ( const double  stickyWeight,
std::valarray< double > const &  startX,
std::valarray< double > const &  startY 
)

Sticky nodes causes nodes to spring back to (startX,startY) when unconstrained.

◆ setStraightenEdges()

void cola::ConstrainedMajorizationLayout::setStraightenEdges ( std::vector< straightener::Edge *> *  straightenEdges,
double  bendWeight = 0.01,
double  potBendWeight = 0.1,
bool  xSkipping = true 
)
inline

For the specified edges (with routings), generate dummy vars and constraints to try and straighten them. bendWeight controls how hard we try to straighten existing bends potBendWeight controls how much we try to keep straight edges straight

◆ setUnsatisfiableConstraintInfo()

void cola::ConstrainedMajorizationLayout::setUnsatisfiableConstraintInfo ( UnsatisfiableConstraintInfos unsatisfiableX,
UnsatisfiableConstraintInfos unsatisfiableY 
)
inline

Register to receive information about unsatisfiable constraints.

In the case of unsatisifiable constraints, the solver will drop unsatisfiable constraints of lowest priority. Information about these will be written to these lists after each iteration of constrained layout.

param[out] unsatisfiableX A pointer to an UnsatisfiableConstraintInfos object that will be used to record unsatisfiable constraints in the x-dimension. param[out] unsatisfiableY A pointer to an UnsatisfiableConstraintInfos object that will be used to record unsatisfiable constraints in the y-dimension.


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