Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
hierarchical.cpp
Go to the documentation of this file.
2#include <ogdf/basic/Graph.h>
8#include <iostream>
9#include <string>
10
11using namespace ogdf;
12
13int main()
14{
15 Graph G;
16 GraphAttributes GA(G,
23 if (!GraphIO::read(GA, G, "unix-history.gml")) {
24 std::cerr << "Could not load unix-history.gml" << std::endl;
25 return 1;
26 }
27
31
33 ohl->layerDistance(30.0);
34 ohl->nodeDistance(25.0);
35 ohl->weightBalancing(0.8);
36 SL.setLayout(ohl);
37
38 SL.call(GA);
39 GraphIO::write(GA, "output-unix-history-hierarchical.gml");
40 GraphIO::write(GA, "output-unix-history-hierarchical.svg");
41
42 return 0;
43}
Includes declaration of graph class.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Declares class GraphIO which provides access to all graph read and write functionality.
Declaration of class MedianHeuristic.
Declaration and implementation of the optimal third phase of the Sugiyama algorithm.
Declaration of optimal ranking algorithm for Sugiyama algorithm.
Declaration of Sugiyama algorithm.
Stores additional attributes of a graph (like layout information).
static const long edgeStyle
Corresponds to edge attributes strokeColor(edge), strokeType(edge), and strokeWidth(edge).
static const long nodeLabel
Corresponds to node attribute label(node).
static const long nodeTemplate
Corresponds to node attribute templateNode(node).
static const long nodeStyle
Corresponds to node attributes strokeColor(node), strokeType(node), strokeWidth(node),...
static const long edgeGraphics
Corresponds to edge attribute bends(edge).
static const long nodeGraphics
Corresponds to node attributes x(node), y(node), width(node), height(node), and shape(node).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
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.
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.
The median heuristic for 2-layer crossing minimization.
The LP-based hierarchy layout algorithm.
double layerDistance() const
Returns the minimal allowed y-distance between layers.
double weightBalancing() const
Returns the weight for balancing successors below a node; 0.0 means no balancing.
double nodeDistance() const
Returns the minimal allowed x-distance between nodes on a layer.
The optimal ranking algorithm.
Sugiyama's layout algorithm.
void setLayout(HierarchyLayoutModule *pLayout)
Sets the module option for the computation of the final layout.
void setCrossMin(LayeredCrossMinModule *pCrossMin)
Sets the module option for the two-layer crossing minimization.
virtual void call(GraphAttributes &GA) override
Calls the layout algorithm for graph GA.
void setRanking(RankingModule *pRanking)
Sets the module option for the node ranking (layer assignment).
int main()
The namespace for all OGDF objects.