Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
EnergyFunction.h
Go to the documentation of this file.
1
36#pragma once
37
39
40namespace ogdf {
41namespace davidson_harel {
42
44
48public:
51
52 virtual ~EnergyFunction() { }
53
55 virtual void computeEnergy() = 0;
56
58 double computeCandidateEnergy(const node v, const DPoint& newPos);
59
61 string getName() const { return m_name; }
62
67
68#ifdef OGDF_DEBUG
70 void printStatus() const;
71#endif
72
73 double energy() const { return m_energy; }
74
75protected:
76 const Graph& m_G;
77 const string m_name;
79 double m_energy;
80
82 DPoint testPos() { return m_testPos; }
83
85 DPoint currentPos(const node v) const { return m_AG.point(v); }
86
88 node testNode() const { return m_testNode; }
89
91 virtual void internalCandidateTaken() = 0;
92
94 virtual void compCandEnergy() = 0;
95
96#ifdef OGDF_DEBUG
97 virtual void printInternalData() const = 0;
98#endif
99
100private:
103
106
110};
111
112}
113}
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Stores additional attributes of a graph (like layout information).
DPoint point(node v) const
Returns a DPoint corresponding to the x- and y-coordinates of v.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Class for the representation of nodes.
Definition Graph_d.h:177
The interface for energy functions for the Davidson Harel graph drawing method.
const string m_name
name of the energy function
EnergyFunction & operator=(const EnergyFunction &e)
the assignment operator is fake and can not be used.
const Graph & m_G
the graph that should be drawn
virtual void internalCandidateTaken()=0
changes the data of a specific energy function if the candidate was taken
DPoint currentPos(const node v) const
returns the current position of vertex v
node m_testNode
The node that changed position in the candidate.
string getName() const
prints the name of the energy function
node testNode() const
returns the vertex that is under consideration in the current step
GraphAttributes & m_AG
This stores the graph with its graphical attributes and the current positions for the vertices.
DPoint m_testPos
New candidate positions for m_testNode.
EnergyFunction(const string &funcname, GraphAttributes &AG)
Initializes data dtructures to speed up later computations.
double m_candidateEnergy
the energy of the layout if the candidate layout is chosen
DPoint testPos()
returns candidate position for the node to be moved
virtual void computeEnergy()=0
computes energy for the layout at the beginning of the optimization process
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 move...
void candidateTaken()
Changes m_currentX and m_currentY by setting the position of m_testNode to m_testX and m_testY....
double m_energy
energy of the current layout
EnergyFunction(const EnergyFunction &e)
the copy constructor is fake and can not be used.
virtual void compCandEnergy()=0
computes the energy if m_testNode changes position to m_testX and m_testY, sets the value of m_candid...
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.