Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

ogdf::davidson_harel::Attraction Class Reference

Energy function for attraction between two adjacent vertices. More...

#include <ogdf/energybased/davidson_harel/Attraction.h>

+ Inheritance diagram for ogdf::davidson_harel::Attraction:

Public Member Functions

 Attraction (GraphAttributes &AG)
 
 ~Attraction ()
 
void reinitializeEdgeLength (double multi)
 set multiplier for the edge length with repspect to node size to multi More...
 
void setPreferredEdgelength (double length)
 set the preferred edge length More...
 
- Public Member Functions inherited from ogdf::davidson_harel::NodePairEnergy
 NodePairEnergy (const string energyname, GraphAttributes &AG)
 
virtual ~NodePairEnergy ()
 
void computeEnergy () override
 computes energy for the layout at the beginning of the optimization process More...
 
- Public Member Functions inherited from ogdf::davidson_harel::EnergyFunction
 EnergyFunction (const string &funcname, GraphAttributes &AG)
 Initializes data dtructures to speed up later computations. More...
 
virtual ~EnergyFunction ()
 
void candidateTaken ()
 Changes m_currentX and m_currentY by setting the position of m_testNode to m_testX and m_testY. Sets m_energy to m_candidateEnergy. Computes the energy of the layout stored in AG. More...
 
double computeCandidateEnergy (const node v, const DPoint &newPos)
 sets m_testNode, m_testX and m_testY and computes the energy for the new configuration (vertex v moves to newPos) More...
 
double energy () const
 
string getName () const
 prints the name of the energy function More...
 

Private Member Functions

double computeCoordEnergy (node, node, const DPoint &, const DPoint &) const override
 computes the energy contributed by the two nodes if they are placed at the two given positions More...
 

Private Attributes

double m_preferredEdgeLength
 the length that that all edges should ideally have More...
 

Static Private Attributes

static const double MULTIPLIER
 Average length and height of nodes is multiplied by this factor to get preferred edge length. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ogdf::davidson_harel::NodePairEnergy
bool adjacent (const node v, const node w) const
 returns true in constant time if two vertices are adjacent. More...
 
int nodeNum (node v) const
 Returns the internal number given to each vertex. More...
 
const DIntersectableRectshape (const node v) const
 Returns the shape of a vertex v as a DIntersectableRect. More...
 
- Protected Member Functions inherited from ogdf::davidson_harel::EnergyFunction
DPoint currentPos (const node v) const
 returns the current position of vertex v More...
 
node testNode () const
 returns the vertex that is under consideration in the current step More...
 
DPoint testPos ()
 returns candidate position for the node to be moved More...
 
- Protected Attributes inherited from ogdf::davidson_harel::EnergyFunction
double m_candidateEnergy
 the energy of the layout if the candidate layout is chosen More...
 
double m_energy
 energy of the current layout More...
 
const Graphm_G
 the graph that should be drawn More...
 
const string m_name
 name of the energy function More...
 

Detailed Description

Energy function for attraction between two adjacent vertices.

Implements an energy function that simulates attraction between two adjacent vertices. There is an optimum distance where the energy is zero. The energy grows quadratic with the difference to the optimum distance. The optimum distance between two adjacent vertices depends on the size of the two vertices.

Definition at line 48 of file Attraction.h.

Constructor & Destructor Documentation

◆ Attraction()

ogdf::davidson_harel::Attraction::Attraction ( GraphAttributes AG)
explicit

◆ ~Attraction()

ogdf::davidson_harel::Attraction::~Attraction ( )
inline

Definition at line 52 of file Attraction.h.

Member Function Documentation

◆ computeCoordEnergy()

double ogdf::davidson_harel::Attraction::computeCoordEnergy ( node  ,
node  ,
const DPoint ,
const DPoint  
) const
overrideprivatevirtual

computes the energy contributed by the two nodes if they are placed at the two given positions

Implements ogdf::davidson_harel::NodePairEnergy.

◆ reinitializeEdgeLength()

void ogdf::davidson_harel::Attraction::reinitializeEdgeLength ( double  multi)

set multiplier for the edge length with repspect to node size to multi

◆ setPreferredEdgelength()

void ogdf::davidson_harel::Attraction::setPreferredEdgelength ( double  length)
inline

set the preferred edge length

Definition at line 54 of file Attraction.h.

Member Data Documentation

◆ m_preferredEdgeLength

double ogdf::davidson_harel::Attraction::m_preferredEdgeLength
private

the length that that all edges should ideally have

Definition at line 64 of file Attraction.h.

◆ MULTIPLIER

const double ogdf::davidson_harel::Attraction::MULTIPLIER
staticprivate

Average length and height of nodes is multiplied by this factor to get preferred edge length.

Definition at line 62 of file Attraction.h.


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