Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
cluster-plan.cpp
Go to the documentation of this file.
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
15using namespace ogdf;
16
17int 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
44 for (edge e : added) {
45 hes.hide(e);
46 }
47
48 GraphIO::write(CGA, "clusters.svg");
49 return 0;
50}
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
Declares ClusterGraphAttributes, an extension of class GraphAttributes, to store clustergraph layout ...
Utilities for reducing from Cluster Planarity to SyncPlan.
Declaration of class ClusterPlanarizationLayout Planarization approach for cluster graphs.
Includes declaration of graph class.
Declares class GraphIO which provides access to all graph read and write functionality.
Declaration and implementation of NodeSet, EdgeSet, and AdjEntrySet classes.
Declaration of doubly linked lists and iterators.
Stores additional attributes of a clustered graph (like layout information).
static const long all
Enables all available flags.
Representation of clustered graphs.
virtual bool clusterPlanarEmbed(ClusterGraph &CG, Graph &G)
Returns true, if CG is cluster-planar, false otherwise. If true, CG contains a cluster-planar embeddi...
The cluster planarization layout algorithm.
virtual void call(Graph &G, ClusterGraphAttributes &acGraph, ClusterGraph &cGraph, bool simpleCConnect=true)
Calls cluster planarization layout with cluster-graph attributes acGraph.
Class for the representation of edges.
Definition Graph_d.h:364
Edge sets.
Definition GraphSets.h:86
Functionality for temporarily hiding edges in constant time.
Definition Graph_d.h:1222
void hide(edge e)
Hides the given edge.
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.
ClusterPlanarity testing in quadratic time using the Synchronized Planarity approach.
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...
int main(void)
Declaration of randomized clustering generators.
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.
The namespace for all OGDF objects.
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...