82 m_K(5.0), m_desLength(0.0), m_distFactor(2.0), m_useLayout(true),
83 m_gItBaseVal(50), m_gItFactor(16)
85 m_maxLocalIt = m_maxGlobalIt = maxVal;
127 return m_maxGlobalIt;
153 void noise(
bool on) {
164 if (m_prevEnergy == startVal)
166 m_prevEnergy = maxdelta;
170 double diff = m_prevEnergy - maxdelta;
171 if (diff < 0.0) diff = -diff;
174 cout <<
"Finished(): maxdelta: "<< maxdelta<<
" diff/prev: "<<diff / m_prevEnergy<<
"\n";
178 bool done = (maxdelta < m_tolerance);
180 m_prevEnergy = maxdelta;
181 m_prevLEnergy = startVal;
188 if (m_prevLEnergy == startVal)
190 m_prevLEnergy = deltav;
191 return deltav == 0.0;
195 cout <<
"Local delta: "<<deltav<<
"\n";
198 double diff = m_prevLEnergy - deltav;
200 bool done = (deltav == 0.0 || (diff / m_prevLEnergy) < m_ltolerance);
202 m_prevLEnergy = deltav;
208 void adaptLengths(
const Graph& G,
266 static const int maxVal;
278 double pageRatio() {
return m_pageRatio; }
281 void pageRatio(
double x) { m_pageRatio = x; }
284 Scaling scaling()
const {
289 void scaling(Scaling sc) {
294 double scaleFunctionFactor()
const {
295 return m_scaleFactor;
299 void scaleFunctionFactor(
double f) {
304 void userBoundingBox(
double xmin,
double ymin,
double xmax,
double ymax) {
void setZeroLength(double d)
If set != 0, value zerolength is used to determine the desirable edge length by L = zerolength / max ...
Data type for general directed graphs (adjacency list representation).
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
double m_prevLEnergy
local energy
void setMaxLocalIterations(int i)
Sets the number of local iterations to i.
bool m_computeMaxIt
If true, number of iterations is computed depending on number of nodes.
double m_prevEnergy
Big K constant for strength computation.
SpringEmbedderKK()
Constructor: Constructs instance of Kamada Kawai Layout.
~SpringEmbedderKK()
Destructor.
static const double desMinLength
Defines minimum desired edge length.
bool finishedNode(double deltav)
Checks if inner loop (current node) is finished.
int maxLocalIterations() const
It is possible to limit the number of iterations to a fixed value Returns the current setting of iter...
void setDesLength(double d)
Sets desirable edge length directly.
bool m_useLayout
use positions or allow to shuffle nodes to avoid degeneration
bool finished(double maxdelta)
Checks if main loop is finished because local optimum reached.
int m_gItBaseVal
minimum number of global iterations
int m_maxLocalIt
Maximum number of local iterations.
static const double minVal
Dynamic arrays indexed with nodes.
Declaration of class GraphCopy Attributes which manages access on a copy of an attributed graph...
int m_maxGlobalIt
Maximum number of global iterations.
Tuples of two elements (2-tuples).
Stores additional attributes of a graph (like layout information).
int maxGlobalIterations() const
Declaration of interface for layout algorithms (class LayoutModule)
Class for the representation of nodes.
Interface of general layout algorithms.
double m_zeroLength
Length of a side of the display area, used for edge length computation if > 0.
Declaration and implementation of class Tuple2, Tuple3 and Tuple4.
static const double startVal
The namespace for all OGDF objects.
void setMaxGlobalIterations(int i)
Sets the number of global iterations to i.
void computeMaxIterations(bool b)
If set to true, number of iterations is computed depending on G.
The spring-embedder layout algorithm by Kamada and Kawai.
void setGlobalIterationFactor(int i)
void setStopTolerance(double s)
Sets the value for the stop tolerance, below which the system is regarded stable (balanced) and the o...
void setUseLayout(bool b)
If set to true, the given layout is used for the initial positions.
double m_ltolerance
value for local stop criterion
int m_gItFactor
factor for global iterations: m_gItBaseVal+m_gItFactor*|V|
double m_tolerance
The stop criterion when the forces of all strings are considered to be balanced.
Declaration and implementation of class Array2D which implements dynamic two dimensional arrays...