Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

cluster-plan.cpp
Go to the documentation of this file.
1 #include <ogdf/basic/GraphSets.h>
2 #include <ogdf/basic/Graph.h>
3 #include <ogdf/basic/List.h>
10 #include <stdexcept>
11 #include <string>
12 #include <utility>
13 #include <vector>
14 
15 using namespace ogdf;
16 
17 int main(void) {
18  // create a random cluster graph
19  Graph G;
20  ClusterGraph CG(G);
22  randomClusterPlanarGraph(G, CG, 10, 20, 50);
23 
24  // set up the sync plan test
26  std::vector<std::pair<adjEntry, adjEntry>> augmentation;
27  sp.setStoreAugmentation(&augmentation);
28 
29  // run the test + embedder
30  if (!sp.clusterPlanarEmbed(CG, G)) {
31  throw std::runtime_error("Not c-planar!");
32  }
33 
34  // add the computed augmentation edges
35  EdgeSet<> added(G);
36  insertAugmentationEdges(CG, G, augmentation, &added);
37 
38  // the augmentation edges make the instance c-connected c-plane, fixing the embedding for ClusterPlanarizationLayout
40  cpl.call(G, CGA, CG);
41 
42  // now hide the augmentation edges from the generated drawing
43  Graph::HiddenEdgeSet hes(G);
44  for (edge e : added) {
45  hes.hide(e);
46  }
47 
48  GraphIO::write(CGA, "clusters.svg");
49  return 0;
50 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
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::Graph::HiddenEdgeSet
Functionality for temporarily hiding edges in constant time.
Definition: Graph_d.h:1224
ogdf::randomClusterPlanarGraph
void randomClusterPlanarGraph(Graph &G, ClusterGraph &CG, int clusters, int node_per_cluster, int edges_per_cluster)
Create a random planar graph with a c-planar clustering.
ClusterPlanarizationLayout.h
Declaration of class ClusterPlanarizationLayout Planarization approach for cluster graphs.
ogdf::ClusterPlanarizationLayout
The cluster planarization layout algorithm.
Definition: ClusterPlanarizationLayout.h:88
GraphSets.h
Declaration and implementation of NodeSet, EdgeSet, and AdjEntrySet classes.
ogdf::ClusterGraphAttributes
Stores additional attributes of a clustered graph (like layout information).
Definition: ClusterGraphAttributes.h:52
ogdf::SyncPlanClusterPlanarityModule::setStoreAugmentation
void setStoreAugmentation(std::vector< std::pair< adjEntry, adjEntry >> *augmentation)
When set to a non-null pointer, will contain the augmentation edges to make the graph c-connected c-p...
Definition: ClusterPlanarity.h:58
ogdf::ClusterPlanarityModule::clusterPlanarEmbed
virtual bool clusterPlanarEmbed(ClusterGraph &CG, Graph &G)
Returns true, if CG is cluster-planar, false otherwise. If true, CG contains a cluster-planar embeddi...
Definition: ClusterPlanarityModule.h:68
ogdf::SyncPlanClusterPlanarityModule
ClusterPlanarity testing in quadratic time using the Synchronized Planarity approach.
Definition: ClusterPlanarity.h:45
ogdf::Graph::HiddenEdgeSet::hide
void hide(edge e)
Hides the given edge.
GraphIO.h
Declares class GraphIO which provides access to all graph read and write functionality.
ogdf::EdgeSet
Edge sets.
Definition: Graph_d.h:755
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ClusterPlanarity.h
Utilities for reducing from Cluster Planarity to SyncPlan.
ogdf::insertAugmentationEdges
void insertAugmentationEdges(const ClusterGraph &CG, Graph &G, std::vector< std::pair< adjEntry, adjEntry >> &augmentation, EdgeSet<> *added=nullptr, bool embedded=true, bool assert_minimal=true)
Inserts augmentation edges to make a c-plane graph c-connected while maintaining the combinatorial em...
ogdf::ClusterGraphAttributes::all
static const long all
Enables all available flags.
Definition: ClusterGraphAttributes.h:87
ogdf::ClusterPlanarizationLayout::call
virtual void call(Graph &G, ClusterGraphAttributes &acGraph, ClusterGraph &cGraph, bool simpleCConnect=true)
Calls cluster planarization layout with cluster-graph attributes acGraph.
ClusterGraphAttributes.h
Declares ClusterGraphAttributes, an extension of class GraphAttributes, to store clustergraph layout ...
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ClusterGraph.h
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
List.h
Declaration of doubly linked lists and iterators.
clustering.h
Declaration of randomized clustering generators.
ogdf::ClusterGraph
Representation of clustered graphs.
Definition: ClusterGraph.h:346
main
int main(void)
Definition: cluster-plan.cpp:17