Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
orthogonal.cpp
Go to the documentation of this file.
3#include <ogdf/basic/Graph.h>
12#include <iostream>
13#include <string>
14
15using namespace ogdf;
16
17int main()
18{
19 Graph G;
20 GraphAttributes GA(G,
23
24 if (!GraphIO::read(GA, G, "ERDiagram.gml", GraphIO::readGML)) {
25 std::cerr << "Could not read ERDiagram.gml" << std::endl;
26 return 1;
27 }
28
29 for (node v : G.nodes)
30 {
31 GA.width(v) /= 2;
32 GA.height(v) /= 2;
33 }
34
36
39 ps->runs(100);
41 ves->removeReinsert(RemoveReinsertType::All);
42
43 crossMin->setSubgraph(ps);
44 crossMin->setInserter(ves);
45 pl.setCrossMin(crossMin);
46
48 pl.setEmbedder(emb);
49
50 OrthoLayout *ol = new OrthoLayout;
51 ol->separation(20.0);
52 ol->cOverhang(0.4);
53 pl.setPlanarLayouter(ol);
54
55 pl.call(GA);
56
57 GraphIO::write(GA, "output-ERDiagram.gml", GraphIO::writeGML);
58 GraphIO::write(GA, "output-ERDiagram.svg", GraphIO::drawSVG);
59
60 return 0;
61}
Declares ogdf::EmbedderMinDepthMaxFaceLayers.
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.
Decralation of GraphElement and GraphList classes.
Declaration of class OrthoLayout which represents an orthogonal planar drawing algorithm.
Declaration of the PlanarSubgraphFast.
Declaration of class PlanarizationLayout.
Definition of RemoveReinsertType (used for postprocessing in edge insertion algorithms).
Declaration of class SubgraphPlanarizer.
Declaration of class VariablEmbeddingInserter.
Planar graph embedding that minimizes block-nesting depth and maximizes the external face and optimiz...
Stores additional attributes of a graph (like layout information).
double height(node v) const
Returns the height of the bounding box of node v.
double width(node v) const
Returns the width of the bounding box of node v.
static const long edgeType
Corresponds to edge attribute type(edge).
static const long nodeType
Corresponds to node attribute type(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 writeGML(const Graph &G, std::ostream &os)
Writes graph G in GML format to output stream os.
static bool drawSVG(const GraphAttributes &A, std::ostream &os, const SVGSettings &settings)
static bool readGML(Graph &G, std::istream &is)
Reads graph G in GML format from input stream is.
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.
Class for the representation of nodes.
Definition Graph_d.h:241
The Orthogonal layout algorithm for planar graphs.
Definition OrthoLayout.h:44
double separation() const override
Returns the minimum distance between edges and vertices.
Definition OrthoLayout.h:71
double cOverhang() const
Returns the option m_cOverhang, which specifies the minimal distance of incident edges to the corner ...
Definition OrthoLayout.h:80
Computation of a planar subgraph using PQ-trees.
void runs(int nRuns)
Sets the number of randomized runs to nRuns.
The planarization approach for drawing graphs.
void setEmbedder(EmbedderModule *pEmbedder)
Sets the module option for the graph embedding algorithm.
void setPlanarLayouter(LayoutPlanRepModule *pPlanarLayouter)
Sets the module option for the planar layout algorithm.
void call(GraphAttributes &ga) override
Calls planarization layout for GraphAttributes ga.
void setCrossMin(CrossingMinimizationModule *pCrossMin)
Sets the module option for crossing minimization.
The planarization approach for crossing minimization.
void setInserter(EdgeInsertionModule *pInserter)
Sets the module option for the edge insertion module.
void setSubgraph(PlanarSubgraphModule< int > *pSubgraph)
Sets the module option for the computation of the planar subgraph.
void removeReinsert(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
Optimal edge insertion module.
The namespace for all OGDF objects.
int main()