Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

energybased.cpp
Go to the documentation of this file.
2 #include <ogdf/basic/GraphList.h>
3 #include <ogdf/basic/Graph.h>
7 #include <iostream>
8 #include <string>
9 
10 using namespace ogdf;
11 
12 int 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);
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 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
Graph.h
Includes declaration of graph class.
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:371
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:242
ogdf::FMMMLayout::unitEdgeLength
double unitEdgeLength() const
Returns the current setting of option unitEdgeLength.
Definition: FMMMLayout.h:347
ogdf::FMMMLayout::useHighLevelOptions
bool useHighLevelOptions() const
Returns the current setting of option useHighLevelOptions.
Definition: FMMMLayout.h:329
ogdf::FMMMLayout::call
virtual void call(GraphAttributes &GA) override
Calls the algorithm for graph GA and returns the layout information in GA.
GraphList.h
Decralation of GraphElement and GraphList classes.
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:12
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::GraphAttributes::height
double height(node v) const
Returns the height of the bounding box of node v.
Definition: GraphAttributes.h:393
ogdf::FMMMLayout::newInitialPlacement
bool newInitialPlacement() const
Returns the current setting of option newInitialPlacement.
Definition: FMMMLayout.h:361
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:240
ogdf::GraphAttributes::width
double width(node v) const
Returns the width of the bounding box of node v.
Definition: GraphAttributes.h:357
FMMMOptions.h
Declaration of Fast Multipole Multilevel Method (FM^3) options.