Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

energybased.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);
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);
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 }
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
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::FMMMLayout::qualityVersusSpeed
FMMMOptions::QualityVsSpeed qualityVersusSpeed() const
Returns the current setting of option qualityVersusSpeed.
Definition: FMMMLayout.h:361
ogdf::FMMMOptions::QualityVsSpeed::GorgeousAndEfficient
@ GorgeousAndEfficient
Best quality.
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::FMMMLayout
The fast multipole multilevel layout algorithm.
Definition: FMMMLayout.h:232
ogdf::FMMMLayout::unitEdgeLength
double unitEdgeLength() const
Returns the current setting of option unitEdgeLength.
Definition: FMMMLayout.h:337
ogdf::FMMMLayout::useHighLevelOptions
bool useHighLevelOptions() const
Returns the current setting of option useHighLevelOptions.
Definition: FMMMLayout.h:319
ogdf::FMMMLayout::call
virtual void call(GraphAttributes &GA) override
Calls the algorithm for graph GA and returns the layout information in GA.
FMMMLayout.h
Declaration of Fast Multipole Multilevel Method (FM^3).
GraphIO.h
Declares class GraphIO which provides access to all graph read and write functionality.
main
int main()
Definition: energybased.cpp:6
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::FMMMLayout::newInitialPlacement
bool newInitialPlacement() const
Returns the current setting of option newInitialPlacement.
Definition: FMMMLayout.h:351
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.
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::GraphAttributes::width
double width(node v) const
Returns the width of the bounding box of node v.
Definition: GraphAttributes.h:351