Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

manual.cpp
Go to the documentation of this file.
3 
4 using namespace ogdf;
5 
6 int main()
7 {
8  Graph G;
9  GraphAttributes GA(G,
11 
12  const int LEN = 11;
13  for(int i = 1; i < LEN; ++i) {
14  node left = G.newNode();
15  GA.x(left) = -5*(i+1);
16  GA.y(left) = -20*i;
17  GA.width(left) = 10*(i+1);
18  GA.height(left) = 15;
19 
20  node bottom = G.newNode();
21  GA.x(bottom) = 20*(LEN-i);
22  GA.y(bottom) = 5*(LEN+1-i);
23  GA.width(bottom) = 15;
24  GA.height(bottom) = 10*(LEN+1-i);
25 
26  edge e = G.newEdge(left,bottom);
27  DPolyline &p = GA.bends(e);
28  p.pushBack(DPoint(10,-20*i));
29  p.pushBack(DPoint(20*(LEN-i),-10));
30  }
31 
32  GraphIO::write(GA, "output-manual.gml", GraphIO::writeGML);
33  GraphIO::write(GA, "output-manual.svg", GraphIO::drawSVG);
34 
35  return 0;
36 }
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
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
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::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::GenericPolyline
Polylines with PointType points.
Definition: geometry.h:254
ogdf::GraphAttributes::x
double x(node v) const
Returns the x-coordinate of node v.
Definition: GraphAttributes.h:241
main
int main()
Definition: manual.cpp:6
ogdf::GraphAttributes::bends
const DPolyline & bends(edge e) const
Returns the list of bend points of edge e.
Definition: GraphAttributes.h:658
ogdf::GraphAttributes::y
double y(node v) const
Returns the y-coordinate of node v.
Definition: GraphAttributes.h:259
GraphIO.h
Declares class GraphIO which provides access to all graph read and write functionality.
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::DPoint
GenericPoint< double > DPoint
Representing two-dimensional point with real coordinates.
Definition: geometry.h:237
ogdf::GraphAttributes::edgeGraphics
static const long edgeGraphics
Corresponds to edge attribute bends(edge).
Definition: GraphAttributes.h:116
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
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::List::pushBack
iterator pushBack(const E &x)
Adds element x at the end of the list.
Definition: List.h:1537
ogdf::GraphAttributes::width
double width(node v) const
Returns the width of the bounding box of node v.
Definition: GraphAttributes.h:351