Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

orthogonal.cpp
Go to the documentation of this file.
2 #include <ogdf/basic/GraphList.h>
3 #include <ogdf/basic/Graph.h>
12 #include <iostream>
13 #include <string>
14 
15 using namespace ogdf;
16 
17 int 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 
37  SubgraphPlanarizer *crossMin = new SubgraphPlanarizer;
39  ps->runs(100);
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 }
ogdf::OrthoLayout::separation
double separation() const override
Returns the minimum distance between edges and vertices.
Definition: OrthoLayout.h:71
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
VariableEmbeddingInserter.h
Declaration of class VariablEmbeddingInserter.
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Graph.h
Includes declaration of graph class.
ogdf::RemoveReinsertType::All
@ All
Postproceesing with all edges.
ogdf::GraphIO::write
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.
ogdf::PlanarizationLayout
The planarization approach for drawing graphs.
Definition: PlanarizationLayout.h:59
ogdf::GraphIO::writeGML
static bool writeGML(const Graph &G, std::ostream &os)
Writes graph G in GML format to output stream os.
ogdf::GraphIO::drawSVG
static bool drawSVG(const GraphAttributes &A, std::ostream &os, const SVGSettings &settings)
ogdf::VariableEmbeddingInserter
Optimal edge insertion module.
Definition: VariableEmbeddingInserter.h:58
OrthoLayout.h
Declaration of class OrthoLayout which represents an orthogonal planar drawing algorithm.
PlanarSubgraphFast.h
Declaration of the PlanarSubgraphFast.
RemoveReinsertType.h
Definition of RemoveReinsertType (used for postprocessing in edge insertion algorithms).
SubgraphPlanarizer.h
Declaration of class SubgraphPlanarizer.
ogdf::GraphIO::readGML
static bool readGML(Graph &G, std::istream &is)
Reads graph G in GML format from input stream is.
ogdf::SubgraphPlanarizer::setInserter
void setInserter(EdgeInsertionModule *pInserter)
Sets the module option for the edge insertion module.
Definition: SubgraphPlanarizer.h:139
ogdf::PlanarSubgraphFast
Computation of a planar subgraph using PQ-trees.
Definition: PlanarSubgraphFast.h:82
ogdf::OrthoLayout::cOverhang
double cOverhang() const
Returns the option m_cOverhang, which specifies the minimal distance of incident edges to the corner ...
Definition: OrthoLayout.h:80
ogdf::PlanarizationLayout::setPlanarLayouter
void setPlanarLayouter(LayoutPlanRepModule *pPlanarLayouter)
Sets the module option for the planar layout algorithm.
Definition: PlanarizationLayout.h:136
EmbedderMinDepthMaxFaceLayers.h
Declares ogdf::EmbedderMinDepthMaxFaceLayers.
ogdf::GraphAttributes::edgeType
static const long edgeType
Corresponds to edge attribute type(edge).
Definition: GraphAttributes.h:137
main
int main()
Definition: orthogonal.cpp:17
GraphList.h
Decralation of GraphElement and GraphList classes.
GraphIO.h
Declares class GraphIO which provides access to all graph read and write functionality.
ogdf::PlanarizationLayout::setEmbedder
void setEmbedder(EmbedderModule *pEmbedder)
Sets the module option for the graph embedding algorithm.
Definition: PlanarizationLayout.h:125
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::GraphAttributes::height
double height(node v) const
Returns the height of the bounding box of node v.
Definition: GraphAttributes.h:393
ogdf::OrthoLayout
The Orthogonal layout algorithm for planar graphs.
Definition: OrthoLayout.h:44
ogdf::GraphAttributes::edgeGraphics
static const long edgeGraphics
Corresponds to edge attribute bends(edge).
Definition: GraphAttributes.h:122
ogdf::EmbedderMinDepthMaxFaceLayers
Planar graph embedding that minimizes block-nesting depth and maximizes the external face and optimiz...
Definition: EmbedderMinDepthMaxFaceLayers.h:56
ogdf::SubgraphPlanarizer::setSubgraph
void setSubgraph(PlanarSubgraphModule< int > *pSubgraph)
Sets the module option for the computation of the planar subgraph.
Definition: SubgraphPlanarizer.h:136
ogdf::GraphIO::read
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.
PlanarizationLayout.h
Declaration of class PlanarizationLayout.
ogdf::SubgraphPlanarizer
The planarization approach for crossing minimization.
Definition: SubgraphPlanarizer.h:112
ogdf::VariableEmbeddingInserterBase::removeReinsert
void removeReinsert(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
Definition: VariableEmbeddingInserterBase.h:69
ogdf::PlanarizationLayout::call
void call(GraphAttributes &ga) override
Calls planarization layout for GraphAttributes ga.
ogdf::GraphAttributes::nodeType
static const long nodeType
Corresponds to node attribute type(node).
Definition: GraphAttributes.h:140
ogdf::PlanarizationLayout::setCrossMin
void setCrossMin(CrossingMinimizationModule *pCrossMin)
Sets the module option for crossing minimization.
Definition: PlanarizationLayout.h:117
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::GraphAttributes::nodeGraphics
static const long nodeGraphics
Corresponds to node attributes x(node), y(node), width(node), height(node), and shape(node).
Definition: GraphAttributes.h:119
ogdf::PlanarSubgraphFast::runs
void runs(int nRuns)
Sets the number of randomized runs to nRuns.
Definition: PlanarSubgraphFast.h:180
ogdf::GraphAttributes::width
double width(node v) const
Returns the width of the bounding box of node v.
Definition: GraphAttributes.h:357