82 , m_ltolerance(0.0001)
83 , m_computeMaxIt(true)
85 , m_prevEnergy(startVal)
86 , m_prevLEnergy(startVal)
94 m_maxLocalIt = m_maxGlobalIt = maxVal;
135 return m_maxGlobalIt;
163 void noise(
bool on) {
175 if (m_prevEnergy == startVal)
177 m_prevEnergy = maxdelta;
181 double diff = m_prevEnergy - maxdelta;
182 if (diff < 0.0) diff = -diff;
185 std::cout <<
"Finished(): maxdelta: " << maxdelta <<
" diff/prev: " << diff / m_prevEnergy << std::endl;
189 bool done = (maxdelta < m_tolerance);
191 m_prevEnergy = maxdelta;
192 m_prevLEnergy = startVal;
200 if (m_prevLEnergy == startVal)
202 m_prevLEnergy = deltav;
203 return deltav == 0.0;
207 std::cout <<
"Local delta: " << deltav <<
"\n";
210 double diff = m_prevLEnergy - deltav;
212 bool done = deltav == 0.0 || diff / m_prevLEnergy < m_ltolerance;
214 m_prevLEnergy = deltav;
221 void adaptLengths(
const Graph& G,
293 double pageRatio() {
return m_pageRatio; }
296 void pageRatio(
double x) { m_pageRatio = x; }
299 Scaling scaling()
const {
304 void scaling(Scaling sc) {
309 double scaleFunctionFactor()
const {
310 return m_scaleFactor;
314 void scaleFunctionFactor(
double f) {
319 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 ...
Declaration of class GraphAttributes which extends a Graph by additional attributes.
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.
static const double desMinLength
Defines minimum desired edge length.
static const int maxVal
defines infinite upper bound for iteration number
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
double m_desLength
Desirable edge length, used instead if > 0.
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.
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...