Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
energybased.cpp
Go to the documentation of this file.
3
4using namespace ogdf;
5
6int main()
7{
8 Graph G;
9 GraphAttributes GA(G);
10 if (!GraphIO::read(G, "sierpinski_04.gml")) {
11 std::cerr << "Could not load sierpinski_04.gml" << std::endl;
12 return 1;
13 }
14
15 for (node v : G.nodes)
16 GA.width(v) = GA.height(v) = 5.0;
17
18 FMMMLayout fmmm;
19
20 fmmm.useHighLevelOptions(true);
21 fmmm.unitEdgeLength(15.0);
22 fmmm.newInitialPlacement(true);
23 fmmm.qualityVersusSpeed(FMMMOptions::QualityVsSpeed::GorgeousAndEfficient);
24
25 fmmm.call(GA);
26 GraphIO::write(GA, "output-energybased-sierpinski-layout.gml", GraphIO::writeGML);
27 GraphIO::write(GA, "output-energybased-sierpinski-layout.svg", GraphIO::drawSVG);
28
29 return 0;
30}
Declaration of Fast Multipole Multilevel Method (FM^3).
Declares class GraphIO which provides access to all graph read and write functionality.
The fast multipole multilevel layout algorithm.
Definition FMMMLayout.h:232
FMMMOptions::QualityVsSpeed qualityVersusSpeed() const
Returns the current setting of option qualityVersusSpeed.
Definition FMMMLayout.h:361
double unitEdgeLength() const
Returns the current setting of option unitEdgeLength.
Definition FMMMLayout.h:337
bool useHighLevelOptions() const
Returns the current setting of option useHighLevelOptions.
Definition FMMMLayout.h:319
virtual void call(GraphAttributes &GA) override
Calls the algorithm for graph GA and returns the layout information in GA.
bool newInitialPlacement() const
Returns the current setting of option newInitialPlacement.
Definition FMMMLayout.h:351
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.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
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 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:177
int main()
The namespace for all OGDF objects.