Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
manual.cpp
Go to the documentation of this file.
2#include <ogdf/basic/Graph.h>
5#include <string>
6
7using namespace ogdf;
8
9int main()
10{
11 Graph G;
12 GraphAttributes GA(G,
14
15 const int LEN = 11;
16 for(int i = 1; i < LEN; ++i) {
17 node left = G.newNode();
18 GA.x(left) = -5*(i+1);
19 GA.y(left) = -20*i;
20 GA.width(left) = 10*(i+1);
21 GA.height(left) = 15;
22
23 node bottom = G.newNode();
24 GA.x(bottom) = 20*(LEN-i);
25 GA.y(bottom) = 5*(LEN+1-i);
26 GA.width(bottom) = 15;
27 GA.height(bottom) = 10*(LEN+1-i);
28
29 edge e = G.newEdge(left,bottom);
30 DPolyline &p = GA.bends(e);
31 p.pushBack(DPoint(10,-20*i));
32 p.pushBack(DPoint(20*(LEN-i),-10));
33 }
34
35 GraphIO::write(GA, "output-manual.gml", GraphIO::writeGML);
36 GraphIO::write(GA, "output-manual.svg", GraphIO::drawSVG);
37
38 return 0;
39}
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.
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
Class for the representation of edges.
Definition Graph_d.h:364
Polylines with PointType points.
Definition geometry.h:261
Stores additional attributes of a graph (like layout information).
double y(node v) const
Returns the y-coordinate of node v.
double height(node v) const
Returns the height of the bounding box of node v.
double x(node v) const
Returns the x-coordinate of node v.
double width(node v) const
Returns the width of the bounding box of node v.
const DPolyline & bends(edge e) const
Returns the list of bend points of edge e.
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)
iterator pushBack(const E &x)
Adds element x at the end of the list.
Definition List.h:1547
Class for the representation of nodes.
Definition Graph_d.h:241
int main()
Definition manual.cpp:9
The namespace for all OGDF objects.
GenericPoint< double > DPoint
Representing two-dimensional point with real coordinates.
Definition geometry.h:244