int main() { Graph G; GraphAttributes GA(G, GraphAttributes::nodeGraphics | GraphAttributes::edgeGraphics | GraphAttributes::nodeLabel | GraphAttributes::edgeStyle | GraphAttributes::nodeStyle | GraphAttributes::nodeTemplate); GraphIO::readGML(GA, G, "ERDiagram.gml"); PlanarizationLayout pl; SubgraphPlanarizer *crossMin = new SubgraphPlanarizer; FastPlanarSubgraph *ps = new FastPlanarSubgraph; ps->runs(100); VariableEmbeddingInserter *ves = new VariableEmbeddingInserter; ves->removeReinsert(rrAll); crossMin->setSubgraph(ps); crossMin->setInserter(ves); EmbedderMinDepthMaxFaceLayers *emb = new EmbedderMinDepthMaxFaceLayers; pl.setEmbedder(emb); OrthoLayout *ol = new OrthoLayout; ol->separation(20.0); ol->cOverhang(0.4); pl.setPlanarLayouter(ol); pl.call(GA); GraphIO::writeGML(GA, "ERDiagram-layout.gml"); return 0; }
int ERLayoutAlgorithm(Graph& G, GraphAttributes& GA) { PlanarizationGridLayout pl; SubgraphPlanarizer *crossMin = new SubgraphPlanarizer; // Get a planar subgraph using Boyer Myrvold Algorithm PlanarSubgraphBoyerMyrvold *ps = new PlanarSubgraphBoyerMyrvold; VariableEmbeddingInserter *ves = new VariableEmbeddingInserter; crossMin->setSubgraph(ps); crossMin->setInserter(ves); MixedModelLayout *ol = new MixedModelLayout; MMCBLocalStretch *cb = new MMCBLocalStretch; //ol->separation(180.0); ol->setCrossingsBeautifier(cb); pl.setPlanarLayouter(ol); pl.call(GA); return pl.numberOfCrossings(); }