1#include <ogdf/fileformats/GraphIO.h>
2#include <ogdf/orthogonal/OrthoLayout.h>
3#include <ogdf/planarity/EmbedderMinDepthMaxFaceLayers.h>
4#include <ogdf/planarity/PlanarSubgraphFast.h>
5#include <ogdf/planarity/PlanarizationLayout.h>
6#include <ogdf/planarity/SubgraphPlanarizer.h>
7#include <ogdf/planarity/VariableEmbeddingInserter.h>
8
9using namespace ogdf;
10
11int main()
12{
13 Graph G;
14 GraphAttributes GA(G,
15 GraphAttributes::nodeGraphics | GraphAttributes::nodeType |
16 GraphAttributes::edgeGraphics | GraphAttributes::edgeType);
17
18 if (!GraphIO::read(GA, G, "ERDiagram.gml", GraphIO::readGML)) {
19 std::cerr << "Could not read ERDiagram.gml" << std::endl;
20 return 1;
21 }
22
23 PlanarizationLayout pl;
24
25 SubgraphPlanarizer crossMin;
26
27 auto* ps = new PlanarSubgraphFast<int>;
28 ps->runs(100);
29 VariableEmbeddingInserter *ves = new VariableEmbeddingInserter;
30 ves->removeReinsert(RemoveReinsertType::All);
31
32 crossMin.setSubgraph(ps);
33 crossMin.setInserter(ves);
34
35 EmbedderMinDepthMaxFaceLayers *emb = new EmbedderMinDepthMaxFaceLayers;
36 pl.setEmbedder(emb);
37
38 OrthoLayout *ol = new OrthoLayout;
39 ol->separation(20.0);
40 ol->cOverhang(0.4);
41 pl.setPlanarLayouter(ol);
42
43 pl.call(GA);
44
45 GraphIO::write(GA, "output-ERDiagram.gml", GraphIO::writeGML);
46
47 return 0;
48}
49