Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

orthogonal.cpp
Go to the documentation of this file.
8 
9 using namespace ogdf;
10 
11 int main()
12 {
13  Graph G;
14  GraphAttributes GA(G,
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  for (node v : G.nodes)
24  {
25  GA.width(v) /= 2;
26  GA.height(v) /= 2;
27  }
28 
30 
31  SubgraphPlanarizer *crossMin = new SubgraphPlanarizer;
33  ps->runs(100);
36 
37  crossMin->setSubgraph(ps);
38  crossMin->setInserter(ves);
39  pl.setCrossMin(crossMin);
40 
42  pl.setEmbedder(emb);
43 
44  OrthoLayout *ol = new OrthoLayout;
45  ol->separation(20.0);
46  ol->cOverhang(0.4);
47  pl.setPlanarLayouter(ol);
48 
49  pl.call(GA);
50 
51  GraphIO::write(GA, "output-ERDiagram.gml", GraphIO::writeGML);
52  GraphIO::write(GA, "output-ERDiagram.svg", GraphIO::drawSVG);
53 
54  return 0;
55 }
ogdf::OrthoLayout::separation
double separation() const override
Returns the minimum distance between edges and vertices.
Definition: OrthoLayout.h:68
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
VariableEmbeddingInserter.h
Declaration of class VariablEmbeddingInserter.
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:49
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:51
OrthoLayout.h
Declaration of class OrthoLayout which represents an orthogonal planar drawing algorithm.
PlanarSubgraphFast.h
Declaration of the PlanarSubgraphFast.
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:133
ogdf::PlanarSubgraphFast
Computation of a planar subgraph using PQ-trees.
Definition: PlanarSubgraphFast.h:69
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:77
ogdf::PlanarizationLayout::setPlanarLayouter
void setPlanarLayouter(LayoutPlanRepModule *pPlanarLayouter)
Sets the module option for the planar layout algorithm.
Definition: PlanarizationLayout.h:126
EmbedderMinDepthMaxFaceLayers.h
Declares ogdf::EmbedderMinDepthMaxFaceLayers.
ogdf::GraphAttributes::edgeType
static const long edgeType
Corresponds to edge attribute type(edge).
Definition: GraphAttributes.h:131
main
int main()
Definition: orthogonal.cpp:11
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:115
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
ogdf::GraphAttributes::height
double height(node v) const
Returns the height of the bounding box of node v.
Definition: GraphAttributes.h:387
ogdf::OrthoLayout
The Orthogonal layout algorithm for planar graphs.
Definition: OrthoLayout.h:41
ogdf::GraphAttributes::edgeGraphics
static const long edgeGraphics
Corresponds to edge attribute bends(edge).
Definition: GraphAttributes.h:116
ogdf::EmbedderMinDepthMaxFaceLayers
Planar graph embedding that minimizes block-nesting depth and maximizes the external face and optimiz...
Definition: EmbedderMinDepthMaxFaceLayers.h:52
ogdf::SubgraphPlanarizer::setSubgraph
void setSubgraph(PlanarSubgraphModule< int > *pSubgraph)
Sets the module option for the computation of the planar subgraph.
Definition: SubgraphPlanarizer.h:130
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:106
ogdf::VariableEmbeddingInserterBase::removeReinsert
void removeReinsert(RemoveReinsertType rrOption)
Sets the remove-reinsert postprocessing method.
Definition: VariableEmbeddingInserterBase.h:68
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:134
ogdf::PlanarizationLayout::setCrossMin
void setCrossMin(CrossingMinimizationModule *pCrossMin)
Sets the module option for crossing minimization.
Definition: PlanarizationLayout.h:107
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
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:113
ogdf::PlanarSubgraphFast::runs
void runs(int nRuns)
Sets the number of randomized runs to nRuns.
Definition: PlanarSubgraphFast.h:167
ogdf::GraphAttributes::width
double width(node v) const
Returns the width of the bounding box of node v.
Definition: GraphAttributes.h:351