Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ModularMultilevelMixer.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 #include <ogdf/basic/basic.h>
38 
39 #include <memory>
40 
41 namespace ogdf {
42 class GraphAttributes;
43 class MultilevelGraph;
44 
46 
76 private:
78 
83  std::unique_ptr<LayoutModule> m_oneLevelLayoutModule;
84 
86 
91  std::unique_ptr<LayoutModule> m_finalLayoutModule;
92 
94  std::unique_ptr<MultilevelBuilder> m_multilevelBuilder;
95 
97  std::unique_ptr<InitialPlacer> m_initialPlacement;
98 
100  int m_times;
101 
104 
107 
109 
111  bool m_randomize;
112 
113 public:
115  enum class erc {
116  None,
117  LevelBound
118  };
119 
121 
123  void setLevelLayoutModule(LayoutModule* levelLayout) {
124  m_oneLevelLayoutModule.reset(levelLayout);
125  }
126 
128  void setFinalLayoutModule(LayoutModule* finalLayout) { m_finalLayoutModule.reset(finalLayout); }
129 
132  m_multilevelBuilder.reset(levelBuilder);
133  }
134 
136  void setInitialPlacer(InitialPlacer* placement) { m_initialPlacement.reset(placement); }
137 
139  void setLayoutRepeats(int times = 1) { m_times = times; }
140 
142  void setAllEdgeLengths(double len) { m_fixedEdgeLength = len; }
143 
145  void setAllNodeSizes(double size) { m_fixedNodeSize = size; }
146 
148  void setRandomize(bool b) { m_randomize = b; }
149 
151  void setLevelBound(bool b) { m_levelBound = b; }
152 
154  void call(GraphAttributes& GA) override;
155 
166 #if 0
167  virtual void call(MultilevelGraph &MLG) {
168  GraphAttributes GA(MLG.getGraph());
169  MLG.exportAttributesSimple(GA);
170  call(GA);
171  MLG.importAttributesSimple(GA);
172  };
173 #else
174  virtual void call(MultilevelGraph& MLG);
175 #endif
176 
178  erc errorCode() { return m_errorCode; }
179 
181  double coarseningRatio() { return m_coarseningRatio; }
182 
183 private:
185 };
186 
187 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
ogdf::ModularMultilevelMixer::setInitialPlacer
void setInitialPlacer(InitialPlacer *placement)
Sets the initial placer module to placement.
Definition: ModularMultilevelMixer.h:136
ogdf::ModularMultilevelMixer::setLevelBound
void setLevelBound(bool b)
Determines if computation is stopped when number of levels is too high.
Definition: ModularMultilevelMixer.h:151
ogdf::MultilevelGraph::getGraph
Graph & getGraph()
Definition: MultilevelGraph.h:140
ogdf::MultilevelGraph::exportAttributesSimple
void exportAttributesSimple(GraphAttributes &GA) const
ogdf::ModularMultilevelMixer::m_errorCode
erc m_errorCode
The error code of the last call.
Definition: ModularMultilevelMixer.h:184
ogdf::ModularMultilevelMixer::m_oneLevelLayoutModule
std::unique_ptr< LayoutModule > m_oneLevelLayoutModule
The layout algorithm applied on each level.
Definition: ModularMultilevelMixer.h:83
ogdf::ModularMultilevelMixer::erc
erc
Error codes for calls.
Definition: ModularMultilevelMixer.h:115
ogdf::ModularMultilevelMixer::m_fixedNodeSize
double m_fixedNodeSize
If set to a value > 0, all node sizes will be set to this value.
Definition: ModularMultilevelMixer.h:106
LayoutModule.h
Declaration of interface for layout algorithms (class LayoutModule)
ogdf::MultilevelGraph
Definition: MultilevelGraph.h:69
ogdf::ModularMultilevelMixer::m_randomize
bool m_randomize
Determines if initial random layout is computed.
Definition: ModularMultilevelMixer.h:111
ogdf::InitialPlacer
Base class for placer modules.
Definition: InitialPlacer.h:43
ogdf::ModularMultilevelMixer::m_coarseningRatio
double m_coarseningRatio
Ratio between sizes of previous (p) and current (c) level graphs: c/p.
Definition: ModularMultilevelMixer.h:108
ogdf::ModularMultilevelMixer::setLayoutRepeats
void setLayoutRepeats(int times=1)
Determines how many times the one-level layout will be called.
Definition: ModularMultilevelMixer.h:139
ogdf::ModularMultilevelMixer::errorCode
erc errorCode()
Returns the error code of last call.
Definition: ModularMultilevelMixer.h:178
ogdf::ModularMultilevelMixer::setAllEdgeLengths
void setAllEdgeLengths(double len)
If len > 0, all edge weights will be set to len.
Definition: ModularMultilevelMixer.h:142
ogdf::ModularMultilevelMixer::setFinalLayoutModule
void setFinalLayoutModule(LayoutModule *finalLayout)
Sets the final layout module to finalLayout.
Definition: ModularMultilevelMixer.h:128
ogdf::ModularMultilevelMixer::m_finalLayoutModule
std::unique_ptr< LayoutModule > m_finalLayoutModule
The layout algorithm applied on the last level (i.e., the largest graph in the multilevel hierarchy).
Definition: ModularMultilevelMixer.h:91
ogdf::MultilevelBuilder
Base class for merger modules.
Definition: MultilevelBuilder.h:43
ogdf::ModularMultilevelMixer::m_times
int m_times
The one-level layout will be called m_times to improve quality.
Definition: ModularMultilevelMixer.h:100
ogdf::ModularMultilevelMixer::setAllNodeSizes
void setAllNodeSizes(double size)
If size > 0, all node sizes will be set to size.
Definition: ModularMultilevelMixer.h:145
basic.h
Basic declarations, included by all source files.
ogdf::ModularMultilevelMixer::m_multilevelBuilder
std::unique_ptr< MultilevelBuilder > m_multilevelBuilder
The multilevel builder module computes the multilevel hierarchy.
Definition: ModularMultilevelMixer.h:94
ogdf::ModularMultilevelMixer::m_initialPlacement
std::unique_ptr< InitialPlacer > m_initialPlacement
The initial placer module computes the initial positions for nodes inserted into the previous level.
Definition: ModularMultilevelMixer.h:97
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::ModularMultilevelMixer::setRandomize
void setRandomize(bool b)
Determines if an initial random layout is computed.
Definition: ModularMultilevelMixer.h:148
ogdf::ModularMultilevelMixer::m_fixedEdgeLength
double m_fixedEdgeLength
If set to a value > 0, all edge weights will be set to this value.
Definition: ModularMultilevelMixer.h:103
ogdf::ModularMultilevelMixer::coarseningRatio
double coarseningRatio()
Returns the ratio c/p between sizes of previous (p) and current (c) level graphs.
Definition: ModularMultilevelMixer.h:181
ogdf::ModularMultilevelMixer
Modular multilevel graph layout.
Definition: ModularMultilevelMixer.h:75
ogdf::MultilevelGraph::importAttributesSimple
void importAttributesSimple(const GraphAttributes &GA)
ogdf::ModularMultilevelMixer::m_levelBound
bool m_levelBound
Determines if computation is stopped when number of levels is too high.
Definition: ModularMultilevelMixer.h:110
InitialPlacer.h
Abstract InitialPlacer places the nodes of the level into the next.
MultilevelBuilder.h
Declaration of MultilevelBuilder.
ogdf::IntersectionType::None
@ None
Two geometric objects do not intersect.
ogdf::ModularMultilevelMixer::setMultilevelBuilder
void setMultilevelBuilder(MultilevelBuilder *levelBuilder)
Sets the multilevel builder module to levelBuilder.
Definition: ModularMultilevelMixer.h:131
ogdf::LayoutModule
Interface of general layout algorithms.
Definition: LayoutModule.h:45
ogdf::ModularMultilevelMixer::setLevelLayoutModule
void setLevelLayoutModule(LayoutModule *levelLayout)
Sets the one-level layout module to levelLayout.
Definition: ModularMultilevelMixer.h:123