Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

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 {
49 public:
51  EnergyFunction(const string &funcname, GraphAttributes &AG);
52 
53  virtual ~EnergyFunction() { }
54 
56  virtual void computeEnergy() = 0;
57 
60  const node v,
61  const DPoint &newPos);
62 
64  string getName() const { return m_name; }
65 
67  void candidateTaken();
68 
69 #ifdef OGDF_DEBUG
70  void printStatus() const;
72 #endif
73 
74  double energy() const { return m_energy; }
75 
76 protected:
77  const Graph &m_G;
78  const string m_name;
80  double m_energy;
81 
83  DPoint testPos() { return m_testPos; }
84 
86  DPoint currentPos(const node v) const { return DPoint(m_AG.x(v),m_AG.y(v)); }
87 
89  node testNode() const { return m_testNode; }
90 
92  virtual void internalCandidateTaken() = 0;
93 
95  virtual void compCandEnergy() = 0;
96 
97 #ifdef OGDF_DEBUG
98  virtual void printInternalData() const = 0;
99 #endif
100 
101 private:
103  EnergyFunction(const EnergyFunction &e) : m_G(e.m_G), m_name(e.m_name), m_AG(e.m_AG) { }
104 
107 
111 };
112 
113 }}
DPoint m_testPos
New candidate positions for m_testNode.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
void candidateTaken()
Changes m_currentX and m_currentY by setting the position of m_testNode to m_testX and m_testY...
DPoint currentPos(const node v) const
returns the current position of vertex v
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
virtual void compCandEnergy()=0
computes the energy if m_testNode changes position to m_testX and m_testY, sets the value of m_candid...
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...
double m_candidateEnergy
the energy of the layout if the candidate layout is chosen
Real points.
Definition: geometry.h:219
virtual void computeEnergy()=0
computes energy for the layout at the beginning of the optimization process
double m_energy
energy of the current layout
The interface for energy functions for the Davidson Harel graph drawing method.
virtual void internalCandidateTaken()=0
changes the data of a specific energy function if the candidate was taken
double y(node v) const
Returns the y-coordinate of node v.
node testNode() const
returns the vertex that is under consideration in the current step
Stores additional attributes of a graph (like layout information).
EnergyFunction(const EnergyFunction &e)
the copy constructor is fake and can not be used.
DPoint testPos()
returns candidate position for the node to be moved
double x(node v) const
Returns the x-coordinate of node v.
Class for the representation of nodes.
Definition: Graph_d.h:167
const Graph & m_G
the graph that should be drawn
node m_testNode
The node that changed position in the candidate.
GraphAttributes & m_AG
This stores the graph with its graphical attributes and the current positions for the vertices...
The namespace for all OGDF objects.
const string m_name
name of the energy function
string getName() const
prints the name of the energy function
EnergyFunction & operator=(const EnergyFunction &e)
the assignment operator is fake and can not be used.
EnergyFunction(const string &funcname, GraphAttributes &AG)
Initializes data dtructures to speed up later computations.