Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

hierarchical.cpp
Go to the documentation of this file.
6 
7 using namespace ogdf;
8 
9 int main()
10 {
11  Graph G;
12  GraphAttributes GA(G,
19  if (!GraphIO::read(GA, G, "unix-history.gml")) {
20  std::cerr << "Could not load unix-history.gml" << std::endl;
21  return 1;
22  }
23 
24  SugiyamaLayout SL;
25  SL.setRanking(new OptimalRanking);
27 
29  ohl->layerDistance(30.0);
30  ohl->nodeDistance(25.0);
31  ohl->weightBalancing(0.8);
32  SL.setLayout(ohl);
33 
34  SL.call(GA);
35  GraphIO::write(GA, "output-unix-history-hierarchical.gml");
36  GraphIO::write(GA, "output-unix-history-hierarchical.svg");
37 
38  return 0;
39 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
MedianHeuristic.h
Declaration of class MedianHeuristic.
ogdf::GraphIO::write
static bool write(const Graph &G, const string &filename, WriterFunc writer=nullptr)
Writes graph G to a file with name filename and infers the format to use from the file's extension.
ogdf::MedianHeuristic
The median heuristic for 2-layer crossing minimization.
Definition: MedianHeuristic.h:42
ogdf::GraphAttributes::edgeStyle
static const long edgeStyle
Corresponds to edge attributes strokeColor(edge), strokeType(edge), and strokeWidth(edge).
Definition: GraphAttributes.h:143
ogdf::GraphAttributes::nodeStyle
static const long nodeStyle
Corresponds to node attributes strokeColor(node), strokeType(node), strokeWidth(node),...
Definition: GraphAttributes.h:147
ogdf::OptimalRanking
The optimal ranking algorithm.
Definition: OptimalRanking.h:75
ogdf::OptimalHierarchyLayout::layerDistance
double layerDistance() const
Returns the minimal allowed y-distance between layers.
Definition: OptimalHierarchyLayout.h:106
ogdf::SugiyamaLayout::call
virtual void call(GraphAttributes &GA) override
Calls the layout algorithm for graph GA.
ogdf::SugiyamaLayout::setCrossMin
void setCrossMin(LayeredCrossMinModule *pCrossMin)
Sets the module option for the two-layer crossing minimization.
Definition: SugiyamaLayout.h:382
OptimalRanking.h
Declaration of optimal ranking algorithm for Sugiyama algorithm.
ogdf::OptimalHierarchyLayout::nodeDistance
double nodeDistance() const
Returns the minimal allowed x-distance between nodes on a layer.
Definition: OptimalHierarchyLayout.h:96
main
int main()
Definition: hierarchical.cpp:9
ogdf::SugiyamaLayout::setLayout
void setLayout(HierarchyLayoutModule *pLayout)
Sets the module option for the computation of the final layout.
Definition: SugiyamaLayout.h:391
ogdf::GraphAttributes::nodeTemplate
static const long nodeTemplate
Corresponds to node attribute templateNode(node).
Definition: GraphAttributes.h:150
GraphIO.h
Declares class GraphIO which provides access to all graph read and write functionality.
ogdf::OptimalHierarchyLayout::weightBalancing
double weightBalancing() const
Returns the weight for balancing successors below a node; 0.0 means no balancing.
Definition: OptimalHierarchyLayout.h:136
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::GraphAttributes::nodeLabel
static const long nodeLabel
Corresponds to node attribute label(node).
Definition: GraphAttributes.h:128
ogdf::SugiyamaLayout
Sugiyama's layout algorithm.
Definition: SugiyamaLayout.h:160
ogdf::GraphAttributes::edgeGraphics
static const long edgeGraphics
Corresponds to edge attribute bends(edge).
Definition: GraphAttributes.h:116
ogdf::SugiyamaLayout::setRanking
void setRanking(RankingModule *pRanking)
Sets the module option for the node ranking (layer assignment).
Definition: SugiyamaLayout.h:374
ogdf::GraphIO::read
static bool read(Graph &G, const string &filename, ReaderFunc reader=nullptr)
Reads graph G from a file with name filename and infers the used format from the file's extension.
OptimalHierarchyLayout.h
Declaration and implementation of the optimal third phase of the Sugiyama algorithm.
ogdf::GraphAttributes::nodeGraphics
static const long nodeGraphics
Corresponds to node attributes x(node), y(node), width(node), height(node), and shape(node).
Definition: GraphAttributes.h:113
SugiyamaLayout.h
Declaration of Sugiyama algorithm.
ogdf::OptimalHierarchyLayout
The LP-based hierarchy layout algorithm.
Definition: OptimalHierarchyLayout.h:76