Provides various graph generator functions. More...
Classes  
struct  ogdf::RandomClusterConfig 
Parameters for the randomPlanarClustering() method. More...  
Randomized clustering generators  
void  ogdf::randomCConnectedClustering (ClusterGraph &C, int cNum) 
Creates a random cconnected clustering for a given graph G . More...  
void  ogdf::randomClustering (ClusterGraph &C, int cNum) 
Creates a random clustering for a given graph G . More...  
void  ogdf::randomClustering (ClusterGraph &C, const node root, int moreInLeaves) 
Creates a specified cluster structure for a given graph G , and assigns vertices to clusters. More...  
bool  ogdf::randomPlanarClustering (ClusterGraph &CG, const RandomClusterConfig &config) 
Creates a random cplanar clustering for a given planar graph G . More...  
void  ogdf::randomClusterPlanarGraph (Graph &G, ClusterGraph &CG, int clusters, int node_per_cluster, int edges_per_cluster) 
Create a random planar graph with a cplanar clustering. More...  
void  ogdf::randomSyncPlanInstance (sync_plan::SyncPlan &pq, int pipe_count, int min_deg=3) 
Create a random SynchronizedPlanarity instance by introducing pipe_count pipes between vertices of degree at least min_deg . More...  
void  ogdf::randomSEFEInstanceBySharedGraph (Graph *sefe, EdgeArray< uint8_t > &edge_types, int edges1, int edges2) 
Create a (simultaneously planar) 2SEFE instance with a given shared graph. More...  
void  ogdf::randomSEFEInstanceByUnionGraph (const Graph *sefe, EdgeArray< uint8_t > &edge_types, double frac_shared=0.34, double frac_g1=0.33) 
Create a (simultaneously planar) 2SEFE instance with a given union graph. More...  
Deterministic graph generators  
void  ogdf::customGraph (Graph &G, int n, List< std::pair< int, int >> edges, Array< node > &nodes) 
Creates a custom graph using a list of pairs to determine the graph's edges. More...  
void  ogdf::customGraph (Graph &G, int n, List< std::pair< int, int >> edges) 
Creates a custom graph using a list of pairs to determine the graph's edges. More...  
void  ogdf::circulantGraph (Graph &G, int n, Array< int > jumps) 
Creates a circulant graph. More...  
void  ogdf::regularLatticeGraph (Graph &G, int n, int k) 
Creates a regular lattice graph. More...  
void  ogdf::regularTree (Graph &G, int n, int children) 
Creates a regular tree. More...  
void  ogdf::completeGraph (Graph &G, int n) 
Creates the complete graph K_n. More...  
void  ogdf::completeKPartiteGraph (Graph &G, const Array< int > &signature) 
Creates the complete kpartite graph K_{k1,k2,...,kn}. More...  
void  ogdf::completeBipartiteGraph (Graph &G, int n, int m) 
Creates the complete bipartite graph K_{n,m}. More...  
void  ogdf::wheelGraph (Graph &G, int n) 
Creates the graph W_n: A wheel graph. More...  
void  ogdf::cubeGraph (Graph &G, int n) 
Creates the graph Q^n: A n cube graph. More...  
void  ogdf::globeGraph (Graph &G, int meridians, int latitudes) 
Creates a globe graph with a given number of meridians and latitudes. More...  
void  ogdf::suspension (Graph &G, int s) 
Modifies G by adding its s th suspension. More...  
void  ogdf::gridGraph (Graph &G, int n, int m, bool loopN, bool loopM) 
Creates a (toroidal) grid graph on n x m nodes. More...  
void  ogdf::petersenGraph (Graph &G, int n=5, int m=2) 
Creates a generalized Petersen graph. More...  
void  ogdf::emptyGraph (Graph &G, int nodes) 
Creates a graph with nodes nodes and no edges. More...  
Graph operations  
using  ogdf::NodeMap = NodeArray< NodeArray< node > > 
void  ogdf::graphUnion (Graph &G1, const Graph &G2) 
Forms the disjoint union of G1 and G2 . More...  
void  ogdf::graphUnion (Graph &G1, const Graph &G2, NodeArray< node > &map2to1, bool parallelfree=false, bool directed=false) 
Forms the union of G1 and G2 while identifying nodes from G2 with nodes from G1 . More...  
void  ogdf::graphProduct (const Graph &G1, const Graph &G2, Graph &product, NodeMap &nodeInProduct, const std::function< void(node, node)> &addEdges) 
Computes the graph product of G1 and G2 , using a given function to add edges. More...  
void  ogdf::cartesianProduct (const Graph &G1, const Graph &G2, Graph &product, NodeMap &nodeInProduct) 
Computes the Cartesian product of G1 and G2 and assigns it to product , with \(E = \{(\langle v_1,w_1\rangle, \langle v_1,w_2\rangle)  (w_1,w_2) \in E_2\} \cup \{(\langle v_1,w_1\rangle, \langle v_2,w_1\rangle)  (v_1,v_2) \in E_1\} \). More...  
void  ogdf::tensorProduct (const Graph &G1, const Graph &G2, Graph &product, NodeMap &nodeInProduct) 
Computes the tensor product of G1 and G2 and assigns it to product , with \(E = \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \in E_1 \land (w_1,w_2) \in E_2\} \). More...  
void  ogdf::lexicographicalProduct (const Graph &G1, const Graph &G2, Graph &product, NodeMap &nodeInProduct) 
Computes the lexicographical product of G1 and G2 and assigns it to product , with \(E = \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \in E_1\} \cup \{(\langle v_1,w_1\rangle, \langle v_1,w_2\rangle)  (w_1,w_2) \in E_2\} \). More...  
void  ogdf::strongProduct (const Graph &G1, const Graph &G2, Graph &product, NodeMap &nodeInProduct) 
Computes the strong product of G1 and G2 and assigns it to product , with \(E = \{(\langle v_1,w_1\rangle, \langle v_1,w_2\rangle)  (w_1,w_2) \in E_2\} \cup \{(\langle v_1,w_1\rangle, \langle v_2,w_1\rangle)  (v_1,v_2) \in E_1\} \cup \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \in E_1 \land (w_1,w_2) \in E_2\} \). More...  
void  ogdf::coNormalProduct (const Graph &G1, const Graph &G2, Graph &product, NodeMap &nodeInProduct) 
Computes the conormal product of G1 and G2 and assigns it to product , with \(E = \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \in E_1 \lor (w_1,w_2) \in E_2\} \). More...  
void  ogdf::modularProduct (const Graph &G1, const Graph &G2, Graph &product, NodeMap &nodeInProduct) 
Computes the modular product of G1 and G2 and assigns it to product , with \(E = \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \in E_1 \land (w_1,w_2) \in E_2\} \cup \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \not\in E_1 \land (w_1,w_2) \not\in E_2\} \). More...  
void  ogdf::rootedProduct (const Graph &G1, const Graph &G2, Graph &product, NodeMap &nodeInProduct, node rootInG2) 
Computes the rooted product of G1 and G2 , rooted in rootInG2 , and assigns it to product . More...  
Randomized graph generators  
template<typename D >  
void  ogdf::randomGeographicalThresholdGraph (Graph &G, Array< int > &weights, D &dist, double threshold, std::function< double(double)> h, int dimension=2) 
Creates a random geometric graph where edges are created based on their distance and the weight of nodes. More...  
template<typename D >  
void  ogdf::randomGeographicalThresholdGraph (Graph &G, Array< int > &weights, D &dist, double threshold, int alpha=2, int dimension=2) 
Creates a random geometric graph where edges are created based on their distance and the weight of nodes. More...  
void  ogdf::randomRegularGraph (Graph &G, int n, int d) 
Creates a random d regular graph. More...  
void  ogdf::randomGraph (Graph &G, int n, int m) 
Creates a random graph. More...  
bool  ogdf::randomSimpleGraph (Graph &G, int n, int m) 
Creates a random simple graph. More...  
bool  ogdf::randomSimpleGraphByProbability (Graph &G, int n, double pEdge) 
Creates a random simple graph. More...  
bool  ogdf::randomSimpleConnectedGraph (Graph &G, int n, int m) 
Creates a random simple and connected graph. More...  
void  ogdf::randomBiconnectedGraph (Graph &G, int n, int m) 
Creates a random biconnected graph. More...  
void  ogdf::randomPlanarConnectedGraph (Graph &G, int n, int m) 
Creates a random connected (simple) planar (embedded) graph. More...  
void  ogdf::randomPlanarBiconnectedGraph (Graph &G, int n, int m, bool multiEdges=false) 
Creates a random planar biconnected (embedded) graph. More...  
void  ogdf::randomPlanarBiconnectedDigraph (Graph &G, int n, int m, double p=0, bool multiEdges=false) 
Creates a random planar biconnected acyclic (embedded) digraph. More...  
void  ogdf::randomUpwardPlanarBiconnectedDigraph (Graph &G, int n, int m) 
Creates a random upward planar biconnected (embedded) digraph. More...  
void  ogdf::randomPlanarCNBGraph (Graph &G, int n, int m, int b) 
Creates a random planar graph, that is connected, but not biconnected. More...  
void  ogdf::randomTriconnectedGraph (Graph &G, int n, double p1, double p2) 
Creates a random triconnected (and simple) graph. More...  
void  ogdf::randomPlanarTriconnectedGraph (Graph &G, int n, int m) 
Creates a random planar triconnected (and simple) graph. More...  
void  ogdf::randomPlanarTriconnectedGraph (Graph &G, int n, double p1, double p2) 
Creates a random planar triconnected (and simple) graph. More...  
void  ogdf::randomTree (Graph &G, int n) 
Creates a random tree (simpler version. More...  
void  ogdf::randomTree (Graph &G, int n, int maxDeg, int maxWidth) 
Creates a random tree. More...  
void  ogdf::randomDigraph (Graph &G, int n, double p) 
Creates a random (simple) directed graph. More...  
void  ogdf::randomSeriesParallelDAG (Graph &G, int edges, double p=0.5, double flt=0.0) 
Creates a random (simple, biconnected) series parallel DAG. More...  
void  ogdf::randomGeometricCubeGraph (Graph &G, int nodes, double threshold, int dimension=2) 
Creates a random geometric graph by laying out nodes in a unit ncube. Nodes with a distance < threshold are connected, 0 <= threshold <= sqrt(dimension). The graph is simple. More...  
void  ogdf::randomWaxmanGraph (Graph &G, int nodes, double alpha, double beta, double width=1.0, double height=1.0) 
Generates a Waxman graph where nodes are uniformly randomly placed in a grid, then edges are inserted based on nodes' euclidean distances. More...  
void  ogdf::preferentialAttachmentGraph (Graph &G, int nodes, int minDegree) 
Creates a graph where new nodes are more likely to connect to nodes with high degree. More...  
void  ogdf::randomWattsStrogatzGraph (Graph &G, int n, int k, double probability) 
Creates a "small world" graph as described by Watts & Strogatz. More...  
void  ogdf::randomChungLuGraph (Graph &G, Array< int > expectedDegreeDistribution) 
Creates a graph where edges are inserted based on given weights. More...  
void  ogdf::randomEdgesGraph (Graph &G, std::function< double(node, node)> probability) 
Inserts edges into the given graph based on probabilities given by a callback function. More...  
void  ogdf::randomProperMaximalLevelPlaneGraph (Graph &G, std::vector< std::vector< node >> &emb, int N, int K, bool radial) 
Generates a random proper, maximal (radial) levelplane graph. More...  
void  ogdf::randomHierarchy (Graph &G, int n, int m, bool planar, bool singleSource, bool longEdges) 
Creates a random hierarchical graph. More...  
void  ogdf::pruneEdges (Graph &G, int max_edges, int min_deg) 
Removed random edges from /p G until it has less than /p max_edges edges, not removing edges from nodes with degree less than /p min_deg. More...  
Provides various graph generator functions.
using ogdf::NodeMap = typedef NodeArray<NodeArray<node> > 
Definition at line 72 of file operations.h.
void ogdf::cartesianProduct  (  const Graph &  G1, 
const Graph &  G2,  
Graph &  product,  
NodeMap &  nodeInProduct  
) 
Computes the Cartesian product of G1
and G2
and assigns it to product
, with \(E = \{(\langle v_1,w_1\rangle, \langle v_1,w_2\rangle)  (w_1,w_2) \in E_2\} \cup \{(\langle v_1,w_1\rangle, \langle v_2,w_1\rangle)  (v_1,v_2) \in E_1\} \).
Multiedges are kept and incorporated into the graph product.
G1  is the first input graph. 
G2  is the second input graph. 
product  is assigned the graph product. 
nodeInProduct  is assigned a mapping from nodes of (G1 , G2 ) to product . 
Creates a circulant graph.
Generates a simple, undirected graph on \(n\) nodes \(V := v_0,v_1,\ldots,v_{n1}\) that contains exactly the edges \( \{v_iv_{i+d}\colon v_i \in V, d \in \text{jumps}\} \) where node indices are to be understood modulo \(n\). The order of nodes induced by G
is the sequence \(V\) given above.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
jumps  is the array of distances for edges to be created. ogdf::circulantGraph(G, 11, ogdf::Array<int>({1,2,4}));

void ogdf::completeBipartiteGraph  (  Graph &  G, 
int  n,  
int  m  
) 
Creates the complete bipartite graph K_{n,m}.
The returned graph is directed acyclic.
G  is assigned the generated graph. 
n  is the number of nodes of the first partition set. 
m  is the number of nodes of the second partition set. 
void ogdf::completeGraph  (  Graph &  G, 
int  n  
) 
Creates the complete graph K_n.
The returned graph is directed acyclic.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
Creates the complete kpartite graph K_{k1,k2,...,kn}.
The returned graph is directed acyclic.
G  is assigned the generated graph. 
signature  contains the positive values k1, k2, ..., kn. 
void ogdf::coNormalProduct  (  const Graph &  G1, 
const Graph &  G2,  
Graph &  product,  
NodeMap &  nodeInProduct  
) 
Computes the conormal product of G1
and G2
and assigns it to product
, with \(E = \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \in E_1 \lor (w_1,w_2) \in E_2\} \).
Multiedges are kept and incorporated into the graph product.
G1  is the first input graph. 
G2  is the second input graph. 
product  is assigned the graph product. 
nodeInProduct  is assigned a mapping from nodes of (G1 , G2 ) to product . 
void ogdf::cubeGraph  (  Graph &  G, 
int  n  
) 
Creates the graph Q^n: A n
cube graph.
G  is assigned the generated graph. 
n  is the number of the cube's dimensions (n>=0). 
Creates a custom graph using a list of pairs to determine the graph's edges.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
edges  is a list of pairs, each one representing two nodes that should be connected by an edge in the generated graph. 
Definition at line 64 of file deterministic.h.
void ogdf::customGraph  (  Graph &  G, 
int  n,  
List< std::pair< int, int >>  edges,  
Array< node > &  nodes  
) 
Creates a custom graph using a list of pairs to determine the graph's edges.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
edges  is a list of pairs, each one representing two nodes that should be connected by an edge in the generated graph. 
nodes  resulting array mapping node index to the actual node 
void ogdf::emptyGraph  (  Graph &  G, 
int  nodes  
) 
Creates a graph with nodes
nodes and no edges.
G  is assigned the generated graph. 
nodes  is the number of nodes of the generated graph. 
void ogdf::globeGraph  (  Graph &  G, 
int  meridians,  
int  latitudes  
) 
Creates a globe graph with a given number of meridians and latitudes.
The graph will contain a node at each crossing of a meridian and a latitude, and a node at each pole, hence meridians
* latitudes
+ 2 nodes overall.
G  is assigned the generated graph. 
meridians  is the number of meridians. 
latitudes  is the number of latitudes. 
void ogdf::graphProduct  (  const Graph &  G1, 
const Graph &  G2,  
Graph &  product,  
NodeMap &  nodeInProduct,  
const std::function< void(node, node)> &  addEdges  
) 
Computes the graph product of G1
and G2
, using a given function to add edges.
First, product
is cleared. \(V(G1)\cdotV(G2)\) nodes are added to it and addEdges
is called for each pair of nodes in \(V(G1) \times V(G2)\).
G1  is the first input graph. 
G2  is the second input graph. 
product  is assigned the graph product. 
nodeInProduct  is assigned a mapping from nodes of (G1 , G2 ) to product . 
addEdges  A function that adds edges to the graph product for each pair of nodes in \(V(G1) \times V(G2)\). 
Forms the disjoint union of G1
and G2
.
G1  is the first graph and assigned the graph union. 
G2  is the second graph. 
Definition at line 52 of file operations.h.
void ogdf::graphUnion  (  Graph &  G1, 
const Graph &  G2,  
NodeArray< node > &  map2to1,  
bool  parallelfree = false , 

bool  directed = false 

) 
Forms the union of G1
and G2
while identifying nodes from G2
with nodes from G1
.
G1  is the first graph and assigned the graph union. 
G2  is the second graph. 
map2to1  identifies nodes from G2 with nodes from G1 . Empty entries in map2to1 have to be nullptr . It is assigned a mapping from nodes in G2 to the union G1 . 
parallelfree  sets whether the resulting graph union should not contain multiedges. 
directed  sets whether the graph union is treated as directed or undirected when detecting multiedges. It only has an effect if parallelfree is set. 
void ogdf::gridGraph  (  Graph &  G, 
int  n,  
int  m,  
bool  loopN,  
bool  loopM  
) 
Creates a (toroidal) grid graph on n
x m
nodes.
G  is assigned the generated graph. 
n  is the number of nodes on first axis. 
m  is the number of nodes on second axis. 
loopN  if the grid is cyclic on first axis 
loopM  if the grid is cyclic on second axis 
void ogdf::lexicographicalProduct  (  const Graph &  G1, 
const Graph &  G2,  
Graph &  product,  
NodeMap &  nodeInProduct  
) 
Computes the lexicographical product of G1
and G2
and assigns it to product
, with \(E = \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \in E_1\} \cup \{(\langle v_1,w_1\rangle, \langle v_1,w_2\rangle)  (w_1,w_2) \in E_2\} \).
G1  is the first input graph. 
G2  is the second input graph. 
product  is assigned the graph product. 
nodeInProduct  is assigned a mapping from nodes of (G1 , G2 ) to product . 
void ogdf::modularProduct  (  const Graph &  G1, 
const Graph &  G2,  
Graph &  product,  
NodeMap &  nodeInProduct  
) 
Computes the modular product of G1
and G2
and assigns it to product
, with \(E = \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \in E_1 \land (w_1,w_2) \in E_2\} \cup \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \not\in E_1 \land (w_1,w_2) \not\in E_2\} \).
Multiedges are kept and incorporated into the graph product.
G1  is the first input graph. 
G2  is the second input graph. 
product  is assigned the graph product. 
nodeInProduct  is assigned a mapping from nodes of (G1 , G2 ) to product . 
void ogdf::petersenGraph  (  Graph &  G, 
int  n = 5 , 

int  m = 2 

) 
Creates a generalized Petersen graph.
Creates an outer cycle of nodes 1, ..., n
, each of which has a direct neighbor (a corresponding inner node). For two outer nodes i, j, there is an edge between their corresponding inner nodes if the absolute difference of i and j equals the jump length m
.
If no values for n
or m
are given, assume the standard Petersen graph of 5
nodes and a jump length of 2
.
G  is assigned the generated graph. 
n  is the number of nodes on the outer cycle. 
m  is the length of jumps for the inner part. 
void ogdf::preferentialAttachmentGraph  (  Graph &  G, 
int  nodes,  
int  minDegree  
) 
Creates a graph where new nodes are more likely to connect to nodes with high degree.
Implements the Preferential Attachment algorithm as described in: Emergence of Scaling in Random Networks AlbertLaszlo Barabasi and Reka Albert https://arxiv.org/abs/condmat/9910332v1 This algorithm creates edges based on the degree of nodes, so it is most useful to apply this to a prebuilt graph. If no graph is supplied, a complete graph of minDegree
nodes is generated and the algorithm adds nodes
 minDegree
nodes. If a graph is supplied, it must contain at least minDegree
nodes of degree 1.
G  is the input graph (see above) and is assigned the expanded graph. 
nodes  is the number of nodes to be added to graph. 
minDegree  is the minimum degree of new nodes. 
void ogdf::pruneEdges  (  Graph &  G, 
int  max_edges,  
int  min_deg  
) 
Removed random edges from /p G until it has less than /p max_edges edges, not removing edges from nodes with degree less than /p min_deg.
void ogdf::randomBiconnectedGraph  (  Graph &  G, 
int  n,  
int  m  
) 
Creates a random biconnected graph.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
m  is the number of edges of the generated graph. 
n
has a lower bound of 3, and m
a lower bound of n
. If the parameters are smaller than that, they get increased prior to the algorithm. void ogdf::randomCConnectedClustering  (  ClusterGraph &  C, 
int  cNum  
) 
Creates a random cconnected clustering for a given graph G
.
The resulting cluster graph is always cconnected but may or may not be cplanar (e.g. when a connected cluster encloses some outside vertices).
C  is a cluster graph for G . 
cNum  is the maximal number of Clusters introduced. 
G
is connected and not empty. Creates a graph where edges are inserted based on given weights.
Implements the algorithm described in: The average distance in a random graph with given expected degrees Fang Chung and Linyuan Lu http://www.math.ucsd.edu/~fan/wp/aveflong.pdf
Given an expected degree distribution of length n: \(w:=(w_1, ..., w_n)\) with \(0 < w_k < n\).
Let \(S:=\sum_{k=1}^{n}w_k\) be the sum over all expected degrees. Consider each edge independently and insert it with probability \(p_{ij} := \frac{w_i \, w_j}{S}\). Therefore, to get percentages in \((0,1)\) we assert that \(\max\limits_k(w_k)^2 < S\).
G  is assigned the generated graph. 
expectedDegreeDistribution  is a list of expected degrees, or weights, for the individual nodes. Its length defines the number of nodes n. 
void ogdf::randomClustering  (  ClusterGraph &  C, 
const node  root,  
int  moreInLeaves  
) 
Creates a specified cluster structure for a given graph G
, and assigns vertices to clusters.
This function is called with a graph G
and the root of a second graph, resembling a tree, that gives the cluster structure. Then, the vertices of G are randomly assigned to the clusters, where we can guarantee that any leafcluster has (on average) moreInLeavestimes more vertices than a nonleaf cluster. (E.g. if moreInLeaves
= 5, any leaf will contain roughly 5 times more vertices than an inner cluster)
C  is a cluster graph for G , to be assigned the solution. 
root  is a node in some other graph (say T). T is a tree that we will consider rooted at root . T is the pattern for the cluster hierarchy. 
moreInLeaves  is a factor such that leafclusters have on average moreInLeavestimes more vertices than inner clusters 
G
contains at least twice as many nodes as T has leaves. void ogdf::randomClustering  (  ClusterGraph &  C, 
int  cNum  
) 
Creates a random clustering for a given graph G
.
C  is a cluster graph for G . 
cNum  is the maximal number of clusters introduced. 
G
is connected and not empty. void ogdf::randomClusterPlanarGraph  (  Graph &  G, 
ClusterGraph &  CG,  
int  clusters,  
int  node_per_cluster,  
int  edges_per_cluster  
) 
Create a random planar graph with a cplanar clustering.
The graph is iteratively created by starting with a random planar connected graph and then, for each cluster, choosing an arbitrary vertex and replacing it with a cluster containing another new random planar graph. The replacement is done by identifying pairs of incident edges between the chosen vertex and another random vertex from the new graph. Thus, when a cutvertex is joined in this way, the resulting graph will no longer be cconnected.
G  will be assigned the planar graph. 
CG  will be assigned the cplanar clustering of G . 
clusters  how many clusters to generate. 
node_per_cluster  how many nodes each cluster should directly contain. 
edges_per_cluster  how many edges to add between each clusters' nodes. 
void ogdf::randomDigraph  (  Graph &  G, 
int  n,  
double  p  
) 
Creates a random (simple) directed graph.
G  is assigned the generated graph. 
n  is the number of nodes in the generated graph. 
p  is the probability that an edge is created (for each node pair) 
Inserts edges into the given graph based on probabilities given by a callback function.
Iterates through each distinct pair of nodes and inserts an edge with the probability returned by the provided callback function.
The resulting graph is guaranteed to be simple if:
G  is a graph that should have at least two nodes (so edges can be generated) 
probability  is a callback function that, for any given pair of nodes, returns a probability between 0 and 1 for the two nodes to be connected. 
void ogdf::randomGeographicalThresholdGraph  (  Graph &  G, 
Array< int > &  weights,  
D &  dist,  
double  threshold,  
int  alpha = 2 , 

int  dimension = 2 

) 
Creates a random geometric graph where edges are created based on their distance and the weight of nodes.
This generator uses \(r^{\alpha}\) for the given alpha
as heuristic function.
D  the random distribution to use (see dist ). 
G  is assigned the generated graph. 
weights  has the weights for all nodes in the graph. 
dist  is a random number distribution, e.g. std::uniform_int_distribution<> . It should likely generate values in roughly the same order of magnitude as 1/ 
threshold  is the threshold for edge insertion. 
alpha  is the constant in the heuristic function. 
dimension  is the dimension the nodes are laid out in. 
Definition at line 120 of file randomGeographicalThresholdGraph.h.
void ogdf::randomGeographicalThresholdGraph  (  Graph &  G, 
Array< int > &  weights,  
D &  dist,  
double  threshold,  
std::function< double(double)>  h,  
int  dimension = 2 

) 
Creates a random geometric graph where edges are created based on their distance and the weight of nodes.
Geographical threshold graphs with smallworld and scalefree properties Naoki Masuda, Hiroyoshi Miwa, Norio Konno https://arxiv.org/abs/condmat/0409378
Distribute vertices using an exponential distribution in a ddimensional Euclidean space. Then a pair of vertices with weights w,w' and Euclidean distance \(r:=ww'\) are connected iff for the heuristic function h
holds: \((w+w')*h(r) < \mathrm{threshold}\).
D  the random distribution to use (see dist ). 
G  is assigned the generated graph. 
weights  has the weights for all nodes in the graph. 
dist  is a random number distribution, e.g. std::uniform_int_distribution<> . It should likely generate values in roughly the same order of magnitude as h (threshold ). 
threshold  is the threshold for edge insertion. 
h  is a function that should be decreasing in the distance supplied to it. 
dimension  is the dimension the nodes are laid out in. 
Definition at line 67 of file randomGeographicalThresholdGraph.h.
void ogdf::randomGeometricCubeGraph  (  Graph &  G, 
int  nodes,  
double  threshold,  
int  dimension = 2 

) 
Creates a random geometric graph by laying out nodes in a unit ncube. Nodes with a distance < threshold are connected, 0 <= threshold <= sqrt(dimension). The graph is simple.
G  is assigned the generated graph. 
nodes  is the number of nodes of the generated graph. 
threshold  is threshold radius of nodes which will be connected. 
dimension  is the dimension of the cube. 
void ogdf::randomGraph  (  Graph &  G, 
int  n,  
int  m  
) 
Creates a random graph.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
m  is the number of edges of the generated graph. 
void ogdf::randomHierarchy  (  Graph &  G, 
int  n,  
int  m,  
bool  planar,  
bool  singleSource,  
bool  longEdges  
) 
Creates a random hierarchical graph.
G  is assigned the generated graph. 
n  is the number of nodes. 
m  is the number of edges. 
planar  determines if the resulting graph is (level)planar. 
singleSource  determines if the graph is a singlesource graph. 
longEdges  determines if the graph has long edges (spanning 2 layers or more); otherwise the graph is proper. 
void ogdf::randomPlanarBiconnectedDigraph  (  Graph &  G, 
int  n,  
int  m,  
double  p = 0 , 

bool  multiEdges = false 

) 
Creates a random planar biconnected acyclic (embedded) digraph.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
m  is the number of edges of the generated graph. 
p  up to m * p edges will be reversed preversing acyclicity; default = 0.0. 
multiEdges  determines if the generated graph may contain multiedges; default = false. 
d
is between 0.0 and 1.0 n
has a lower bound of 3, and m
has a lower bound of n
and an upper bound of \(3n6\). The supplied values are adjusted if they are out of these bounds. void ogdf::randomPlanarBiconnectedGraph  (  Graph &  G, 
int  n,  
int  m,  
bool  multiEdges = false 

) 
Creates a random planar biconnected (embedded) graph.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
m  is the number of edges of the generated graph. 
multiEdges  determines if the generated graph may contain multiedges. 
n
has a lower bound of 3, and m
has a lower bound of n
and an upper bound of \(3n6\). The supplied values are adjusted if they are out of these bounds. bool ogdf::randomPlanarClustering  (  ClusterGraph &  CG, 
const RandomClusterConfig &  config  
) 
Creates a random cplanar clustering for a given planar graph G
.
The clusters are created by working on a copy of G
and making it connected as well as triangulated and then:
u
and putting it into a new clustere
such that its other endpoint v
and u
have at most two common neighbors (this ensures cplanarity)v
into the cluster of u
by contracting e
in the copy of G
The clustering is cconnected if we only select edges that were already present in G
instead of being added by the triangulation.
CG  is a cluster graph for some G . 
config  configuration for the random generation 
void ogdf::randomPlanarCNBGraph  (  Graph &  G, 
int  n,  
int  m,  
int  b  
) 
Creates a random planar graph, that is connected, but not biconnected.
G  is assigned the generated graph. 
n  is the max. number of nodes in each biconnected component 
m  is the max. number of edges in each biconnected component 
b  is the number of biconnected components 
void ogdf::randomPlanarConnectedGraph  (  Graph &  G, 
int  n,  
int  m  
) 
Creates a random connected (simple) planar (embedded) graph.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
m  is the number of edges of the generated graph. 
n
has a lower bound of 1, and m
has a lower bound of n
and an upper bound of \(3n6\). The supplied values are adjusted if they are out of these bounds. void ogdf::randomPlanarTriconnectedGraph  (  Graph &  G, 
int  n,  
double  p1,  
double  p2  
) 
Creates a random planar triconnected (and simple) graph.
This graph generator creates a planar triconnected graph by successive node splitting. It starts with the K_4 and performs n
4 node splits. Each such split operation distributes a node's neighbors to the two nodes resulting from the split. Aftewards, two further edges can be added; the probability for adding these edges is given by p1
and p2
. The higher these probabilities, the denser the resulting graph. Note that a simple planar triconnected graph has between 1.5n
and 3n
6 edges.
p1
, p2
<= 1.0.G  is assigned the generated graph. 
n  is the number of nodes in the generated graph. 
p1  is the probability for the first additional edge to be added. 
p2  is the probability for the second additional edge to be added. 
n
has a lower bound of 4 and will get increased to this if smaller. void ogdf::randomPlanarTriconnectedGraph  (  Graph &  G, 
int  n,  
int  m  
) 
Creates a random planar triconnected (and simple) graph.
This graph generator works in two steps.
n
nodes and 1.5n
edges.G  is assigned the generated graph. 
n  is the number of nodes in the generated graph. 
m  is the number of edges in the generated graph. 
n
>= 4 and n
must be even; otherwise, n
is adjusted to the next feasible integer.n
<= m
<= 3n
6; otherwise, m
is adjusted to a feasible value. void ogdf::randomProperMaximalLevelPlaneGraph  (  Graph &  G, 
std::vector< std::vector< node >> &  emb,  
int  N,  
int  K,  
bool  radial  
) 
Generates a random proper, maximal (radial) levelplane graph.
Use pruneEdges() to obtain a nonmaximal (radial) levelplane graph.
G  is assigned the generated graph. 
emb  will be assigned the levelplanar embedding, i.e., for each level an order of its vertices 
N  the number of nodes to generate. 
K  the number of levels to generate. 
radial  whether the graph/embedding should radial levelplane or just levelplane. 
void ogdf::randomRegularGraph  (  Graph &  G, 
int  n,  
int  d  
) 
Creates a random d
regular graph.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
d  is the degree of each vertex 
n
* d
must be even void ogdf::randomSEFEInstanceBySharedGraph  (  Graph *  sefe, 
EdgeArray< uint8_t > &  edge_types,  
int  edges1,  
int  edges2  
) 
Create a (simultaneously planar) 2SEFE instance with a given shared graph.
This works by randomly subdividing the faces of the embedded sefe
, separately for the two exclusive graphs.
sefe  contains the shared graph and will be modified to also contain the exclusive edges. 
edge_types  will be assigned 3 for all shared edges and 1 or 2 for edges in either of the exclusive graphs. 
edges1  the number of edges to create for the first exclusive graph. 
edges2  the number of edges to create for the second exclusive graph. 
sefe
must contain a connected, planarly embedded graph void ogdf::randomSEFEInstanceByUnionGraph  (  const Graph *  sefe, 
EdgeArray< uint8_t > &  edge_types,  
double  frac_shared = 0.34 , 

double  frac_g1 = 0.33 

) 
Create a (simultaneously planar) 2SEFE instance with a given union graph.
This works by randomly assigning edges of the embedded sefe
to either an exclusive or the shared graph.
sefe  contains the desired union graph. 
edge_types  will be assigned 3 for all shared edges and 1 or 2 for edges in either of the exclusive graphs. 
frac_shared  the (expected) fraction of edges to make shared (i.e. type 3). 
frac_g1  the (expected) fraction of edges to assign to exclusive graph 1. 
void ogdf::randomSeriesParallelDAG  (  Graph &  G, 
int  edges,  
double  p = 0.5 , 

double  flt = 0.0 

) 
Creates a random (simple, biconnected) series parallel DAG.
This function creates a random series parallel biconnected DAG. Note, that the resulting graph is trivially upward planar! To use this generator for experiments, e.g. concerning upward planarity, you can fit the graph by reversing some edges with the parameter 0 < flt < 1.
G  is assigned the generated graph. 
edges  is the number of edges in the generated graph. 
p  = probability of a series composition; default = 0.5 
flt  = up to edges*flt edges will be reversed preversing acyclicity; default = 0.0 
p
is in \([0.0, 1.0]\), and flt
is in \([0.0, 1.0)\). bool ogdf::randomSimpleConnectedGraph  (  Graph &  G, 
int  n,  
int  m  
) 
Creates a random simple and connected graph.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
m  is the number of edges of the generated graph. 
bool ogdf::randomSimpleGraph  (  Graph &  G, 
int  n,  
int  m  
) 
Creates a random simple graph.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
m  is the number of edges of the generated graph. 
bool ogdf::randomSimpleGraphByProbability  (  Graph &  G, 
int  n,  
double  pEdge  
) 
Creates a random simple graph.
Algorithm based on PreZER/LogZER from: Sadegh Nobari, Xuesong Lu, Panagiotis Karras, and Stéphane Bressan. 2011. Fast random graph generation. In Proceedings of the 14th International Conference on Extending Database Technology (EDBT/ICDT '11), ACM, New York, NY, USA, 331342. DOI=http://dx.doi.org/10.1145/1951365.1951406
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
pEdge  is the probability for each edge to be added into the graph. 
void ogdf::randomSyncPlanInstance  (  sync_plan::SyncPlan &  pq, 
int  pipe_count,  
int  min_deg = 3 

) 
Create a random SynchronizedPlanarity instance by introducing pipe_count
pipes between vertices of degree at least min_deg
.
void ogdf::randomTree  (  Graph &  G, 
int  n  
) 
Creates a random tree (simpler version.
G  is assigned the tree. 
n  is the number of nodes of the tree. 
void ogdf::randomTree  (  Graph &  G, 
int  n,  
int  maxDeg,  
int  maxWidth  
) 
Creates a random tree.
G  is assigned the tree. 
n  is the number of nodes of the tree. 
maxDeg  is the maximal allowed node degree; 0 means no restriction. 
maxWidth  is the maximal allowed width of a level; 0 means no restriction. 
maxDeg
or maxWidth
are 0 (or negative), they are set to n
void ogdf::randomTriconnectedGraph  (  Graph &  G, 
int  n,  
double  p1,  
double  p2  
) 
Creates a random triconnected (and simple) graph.
The graph generator proceeds as follows. It starts with a K_4 and performs then n
4 split node operations on randomly selected nodes of the graph constructed so far. Each such operation splits a node v into two nodes x and y and distributes v's neighbors to the two nodes such that each node gets at least two neighbors. Additionally, the edge (x,y) is inserted.
The neighbors are distributed such that a neighbor of v becomes
p1
;p1
;p1
 p2
.G  is assigned the generated graph. 
n  is the number of nodes in the generated graph. 
p1  is the probability that an edge is moved only to the left node after splitting a node. 
p2  is the probability that an edge is moved only to the right node after splitting a node. 
The probability for a neighbor to be moved to both split nodes is 1.0  p1
 p2
. The higher this probability, the higher the density of the resulting graph.
p1
+ p2
<= 1.0. n
has a lower bound of 4 and will get increased to this if smaller. void ogdf::randomUpwardPlanarBiconnectedDigraph  (  Graph &  G, 
int  n,  
int  m  
) 
Creates a random upward planar biconnected (embedded) digraph.
G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
m  is the number of edges of the generated graph. 
n
has a lower bound of 3, and m
has a lower bound of n
and an upper bound of \(3n6\). The supplied values are adjusted if they are out of these bounds. void ogdf::randomWattsStrogatzGraph  (  Graph &  G, 
int  n,  
int  k,  
double  probability  
) 
Creates a "small world" graph as described by Watts & Strogatz.
Takes a regular lattice graph and, with given probability, rewires each edge to a random other nonneighbor.
Collective dynamics of ‘smallworld’ networks https://www.nature.com/articles/30918.pdf
k
is close to half of n
for large graphs.G  is assigned the generated graph. 
n  is the number of nodes of the generated graph. 
k  is the initial degree of each node and must be even and smaller than half of n . 
probability  determines how likely each edge is rewired. A probability of 0 will not modify the graph, while one of 1 will cause full randomness. 
void ogdf::randomWaxmanGraph  (  Graph &  G, 
int  nodes,  
double  alpha,  
double  beta,  
double  width = 1.0 , 

double  height = 1.0 

) 
Generates a Waxman graph where nodes are uniformly randomly placed in a grid, then edges are inserted based on nodes' euclidean distances.
Routing of Multipoint Connections Bernard M. Waxman (1988)
After generating the nodes, edges are inserted between each pair of nodes v, w with probability based on their euclidean distance \(\beta \exp{\frac{vw}{m \, \alpha}}\) where \(m:=\max\limits_{u,v}uv\).
G  is assigned the generated graph. 
nodes  is the number of nodes of the generated graph. 
alpha  is a parameter for the probability in the range (0,1]. Small values increase the density of short edges relative to longer ones. 
beta  is a parameter for the probability in the range (0,1]. Large values result in a graph with higher edge density. 
width  is the width of the area the nodes are distributed in. 
height  is the height of the area the nodes are distributed in. 
void ogdf::regularLatticeGraph  (  Graph &  G, 
int  n,  
int  k  
) 
Creates a regular lattice graph.
Generates a cycle on n
sequential nodes, where any two nodes whose distance is at most k
/ 2 are connected by an additional edge.
G  is assigned the generated graph. 
n  is the number of nodes in the graph. 
k  is the degree of each node. 
n
must be at least 4, k
must be an even number between 0 and n2
. void ogdf::regularTree  (  Graph &  G, 
int  n,  
int  children  
) 
Creates a regular tree.
G  is assigned the tree. 
n  is the number of nodes of the tree. 
children  is the number of children per node. root has index 0, the next level has indizes 1...children, the children of node 1 have indizes children+1...2*children, etc. if number of nodes does not allow a regular node, the "last" node will have fewer children. 
void ogdf::rootedProduct  (  const Graph &  G1, 
const Graph &  G2,  
Graph &  product,  
NodeMap &  nodeInProduct,  
node  rootInG2  
) 
Computes the rooted product of G1
and G2
, rooted in rootInG2
, and assigns it to product
.
Multiedges are kept and incorporated into the graph product.
G1  is the first input graph. 
G2  is the second input graph. 
product  is assigned the graph product. 
nodeInProduct  is assigned a mapping from nodes of (G1 , G2 ) to product . 
rootInG2  is the node of G2 that is identified with every node of G1 once in order to create the rooted product. 
void ogdf::strongProduct  (  const Graph &  G1, 
const Graph &  G2,  
Graph &  product,  
NodeMap &  nodeInProduct  
) 
Computes the strong product of G1
and G2
and assigns it to product
, with \(E = \{(\langle v_1,w_1\rangle, \langle v_1,w_2\rangle)  (w_1,w_2) \in E_2\} \cup \{(\langle v_1,w_1\rangle, \langle v_2,w_1\rangle)  (v_1,v_2) \in E_1\} \cup \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \in E_1 \land (w_1,w_2) \in E_2\} \).
Multiedges are kept and incorporated into the graph product.
G1  is the first input graph. 
G2  is the second input graph. 
product  is assigned the graph product. 
nodeInProduct  is assigned a mapping from nodes of (G1 , G2 ) to product . 
void ogdf::suspension  (  Graph &  G, 
int  s  
) 
Modifies G
by adding its s
th suspension.
A suspension node is a node that is connected to all other nodes in the graph. This function adds s
such suspension nodes that will not be directly connected to each other.
G  is the graph to extend. 
s  is the amount of suspension nodes to add. 
void ogdf::tensorProduct  (  const Graph &  G1, 
const Graph &  G2,  
Graph &  product,  
NodeMap &  nodeInProduct  
) 
Computes the tensor product of G1
and G2
and assigns it to product
, with \(E = \{(\langle v_1,w_1\rangle, \langle v_2,w_2\rangle)  (v_1,v_2) \in E_1 \land (w_1,w_2) \in E_2\} \).
Multiedges are kept and incorporated into the graph product.
G1  is the first input graph. 
G2  is the second input graph. 
product  is assigned the graph product. 
nodeInProduct  is assigned a mapping from nodes of (G1 , G2 ) to product . 
void ogdf::wheelGraph  (  Graph &  G, 
int  n  
) 
Creates the graph W_n: A wheel graph.
G  is assigned the generated graph. 
n  is the number of nodes on the rim of the wheel (W_n). 
n
must be at least 2.