Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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