Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

cluster-plan.cpp
Go to the documentation of this file.
1 #include <ogdf/basic/GraphSets.h>
6 
7 using namespace ogdf;
8 
9 int main(void) {
10  // create a random cluster graph
11  Graph G;
12  ClusterGraph CG(G);
14  randomClusterPlanarGraph(G, CG, 10, 20, 50);
15 
16  // set up the sync plan test
18  std::vector<std::pair<adjEntry, adjEntry>> augmentation;
19  sp.setStoreAugmentation(&augmentation);
20 
21  // run the test + embedder
22  if (!sp.clusterPlanarEmbed(CG, G)) {
23  throw std::runtime_error("Not c-planar!");
24  }
25 
26  // add the computed augmentation edges
27  EdgeSet<> added(G);
28  insertAugmentationEdges(CG, G, augmentation, &added);
29 
30  // the augmentation edges make the instance c-connected c-plane, fixing the embedding for ClusterPlanarizationLayout
32  cpl.call(G, CGA, CG);
33 
34  // now hide the augmentation edges from the generated drawing
35  Graph::HiddenEdgeSet hes(G);
36  for (edge e : added) {
37  hes.hide(e);
38  }
39 
40  GraphIO::write(CGA, "clusters.svg");
41  return 0;
42 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
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:1216
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:81
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:46
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:60
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:61
ogdf::SyncPlanClusterPlanarityModule
ClusterPlanarity testing in quadratic time using the Synchronized Planarity approach.
Definition: ClusterPlanarity.h:47
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:748
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
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:81
ogdf::ClusterPlanarizationLayout::call
virtual void call(Graph &G, ClusterGraphAttributes &acGraph, ClusterGraph &cGraph, bool simpleCConnect=true)
Calls cluster planarization layout with cluster-graph attributes acGraph.
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:356
clustering.h
Declaration of randomized clustering generators.
ogdf::ClusterGraph
Representation of clustered graphs.
Definition: ClusterGraph.h:339
main
int main(void)
Definition: cluster-plan.cpp:9