106 GA.
x(v) = coords[v].coords[0];
107 GA.
y(v) = coords[v].coords[1];
130 for (
node v = G.firstNode(); v; v = v->
succ()) {
131 GA.
x(v) = coords[v].coords[0];
132 GA.
y(v) = coords[v].coords[1];
133 GA.
z(v) = coords[v].coords[2];
142 using namespace energybased::dtree;
143 using Embedder = DTreeEmbedder<Dim>;
146 resultCoords.
init(graph);
152 GalaxyLevel levelBegin(graph);
166 for (GalaxyLevel* pCurrLevel = &levelBegin; pCurrLevel !=
nullptr; pCurrLevel = pCurrLevel->nextCoarser()) {
172 int currLevelIndex = numLevels - 1;
174 for (GalaxyLevel* pCurrLevel = pLevelEnd; pCurrLevel; pCurrLevel = pCurrLevel->nextFiner()) {
179 Embedder embedder(pCurrLevel->graph());
182 if (pCurrLevel->isCoarsestLevel()) {
184 for (
node v = pCurrLevel->graph().firstNode(); v; v = v->
succ()) {
186 for (
int d = 0; d < Dim; d++) {
193 for (
node v = pCurrLevel->graph().firstNode(); v; v = v->
succ()) {
195 node v_parent = pCurrLevel->parent(v);
198 for (
int d = 0; d < Dim; d++) {
203 embedder.setPosition(v, d, offset +
randomDouble(-1.0, 1.0));
211 for (
node v = pCurrLevel->graph().firstNode(); v; v = v->
succ()) {
212 embedder.setMass(v, pCurrLevel->weight(v));
215 for (
edge e = pCurrLevel->graph().firstEdge(); e; e = e->
succ()) {
216 embedder.setEdgeWeight(e, pCurrLevel->edgeWeight(e));
223 embedder.scaleNodes(3.0);
224 embedder.doIterationsNewton(numIterations, currThreshold, RepForceFunctionNewton<Dim, 1>, AttrForceFunctionPow<Dim, 2>);
225 embedder.scaleNodes(1.0 / 3.0);
226 embedder.doIterationsNewton(numIterations, currThreshold, RepForceFunctionNewton<Dim, 2>, AttrForceFunctionPow<Dim, 2>);
230 parentPosition.
init(pCurrLevel->graph());
233 for (
node v = pCurrLevel->graph().firstNode(); v; v = v->
succ()) {
235 for (
int d = 0; d < Dim; d++) {
236 parentPosition[v].coords[d] = embedder.position(v, d);
double m_thresholdFinestLevel
void call(const Graph &graph, NodeArray< NodeCoords > &coords)
call the multilevel embedder layout for graph, the result is stored in coords
Data type for general directed graphs (adjacency list representation).
double m_numIterationsFactorPerLevel
bool has(long attr) const
Returns true iff all attributes in attr are available.
void init()
Reinitializes the array. Associates the array with no graph.
node firstNode() const
Returns the first node in the list of all nodes.
int m_maxIterationsPerLevel
node succ() const
Returns the successor in the list of all nodes.
void call(GraphAttributes &GA) override
Computes a layout of graph GA.
double m_thresholdCoarsestLevel
double y(node v) const
Returns the y-coordinate of node v.
Dynamic arrays indexed with nodes.
Stores additional attributes of a graph (like layout information).
double randomDouble(double low, double high)
Returns a random double value from the interval [low, high).
Class for the representation of edges.
double z(node v) const
Returns the z-coordinate of node v.
static const long threeD
Corresponds to node attribute z(node). Note that all methods work on 2D coordinates only...
double x(node v) const
Returns the x-coordinate of node v.
Declaration of interface for layout algorithms (class LayoutModule)
Class for the representation of nodes.
const Graph & constGraph() const
Returns a reference to the associated graph.
bool m_useMultilevelWeights
Interface of general layout algorithms.
void call(GraphAttributes &GA) override
Computes a layout of graph GA.
DTreeMultilevelEmbedder()
constructor with a given graph, allocates memory and does initialization
edge succ() const
Returns the successor in the list of all edges.
double m_scaleFactorPerLevel
Declaration of simple graph algorithms.
The namespace for all OGDF objects.
int m_minIterationsPerLevel
bool isConnected(const Graph &G)
Returns true iff G is connected.
int m_numIterationsCoarsestLevel
int m_numIterationsFinestLevel
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
double m_thresholdFactorPerLevel