Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
energybased.cpp
Go to the documentation of this file.
3#include <ogdf/basic/Graph.h>
7#include <iostream>
8#include <string>
9
10using namespace ogdf;
11
12int main()
13{
14 Graph G;
15 GraphAttributes GA(G);
16 if (!GraphIO::read(G, "sierpinski_04.gml")) {
17 std::cerr << "Could not load sierpinski_04.gml" << std::endl;
18 return 1;
19 }
20
21 for (node v : G.nodes)
22 GA.width(v) = GA.height(v) = 5.0;
23
24 FMMMLayout fmmm;
25
26 fmmm.useHighLevelOptions(true);
27 fmmm.unitEdgeLength(15.0);
28 fmmm.newInitialPlacement(true);
29 fmmm.qualityVersusSpeed(FMMMOptions::QualityVsSpeed::GorgeousAndEfficient);
30
31 fmmm.call(GA);
32 GraphIO::write(GA, "output-energybased-sierpinski-layout.gml", GraphIO::writeGML);
33 GraphIO::write(GA, "output-energybased-sierpinski-layout.svg", GraphIO::drawSVG);
34
35 return 0;
36}
Declaration of Fast Multipole Multilevel Method (FM^3).
Declaration of Fast Multipole Multilevel Method (FM^3) options.
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.
Decralation of GraphElement and GraphList classes.
The fast multipole multilevel layout algorithm.
Definition FMMMLayout.h:242
FMMMOptions::QualityVsSpeed qualityVersusSpeed() const
Returns the current setting of option qualityVersusSpeed.
Definition FMMMLayout.h:371
double unitEdgeLength() const
Returns the current setting of option unitEdgeLength.
Definition FMMMLayout.h:347
bool useHighLevelOptions() const
Returns the current setting of option useHighLevelOptions.
Definition FMMMLayout.h:329
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:361
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: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)
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:241
int main()
The namespace for all OGDF objects.