1#include <ogdf/fileformats/GraphIO.h>
2#include <ogdf/layered/MedianHeuristic.h>
3#include <ogdf/layered/OptimalHierarchyLayout.h>
4#include <ogdf/layered/OptimalRanking.h>
5#include <ogdf/layered/SugiyamaLayout.h>
6
7using namespace ogdf;
8
9int main()
10{
11 Graph G;
12 GraphAttributes GA(G,
13 GraphAttributes::nodeGraphics |
14 GraphAttributes::edgeGraphics |
15 GraphAttributes::nodeLabel |
16 GraphAttributes::edgeStyle |
17 GraphAttributes::nodeStyle |
18 GraphAttributes::nodeTemplate);
19 if (!GraphIO::read(GA, G, "unix-history.gml", GraphIO::readGML)) {
20 std::cerr << "Could not load unix-history.gml" << std::endl;
21 return 1;
22 }
23
24 SugiyamaLayout SL;
25 SL.setRanking(new OptimalRanking);
26 SL.setCrossMin(new MedianHeuristic);
27
28 OptimalHierarchyLayout *ohl = new OptimalHierarchyLayout;
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.svg", GraphIO::drawSVG);
36
37 return 0;
38}
39