public class DigraphGenerator extends java.lang.Object
For additional documentation, see Section 4.2 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
Constructor  Description 

DigraphGenerator() 
Modifier and Type  Method  Description 

static Digraph 
binaryTree(int V) 
Returns a complete binary tree digraph on V vertices.

static Digraph 
complete(int V) 
Returns the complete digraph on V vertices.

static Digraph 
cycle(int V) 
Returns a cycle digraph on V vertices.

static Digraph 
dag(int V,
int E) 
Returns a random simple DAG containing V vertices and E edges.

static Digraph 
fromIn(In in) 

static void 
main(java.lang.String[] args) 

static Digraph 
path(int V) 
Returns a path digraph on V vertices.

static Digraph 
random(int V,
int E) 
Create a random digraph with V vertices and E edges.

static Digraph 
rootedInDAG(int V,
int E) 
Returns a random rootedin DAG on V vertices and E edges.

static Digraph 
rootedInTree(int V) 
Returns a random rootedin tree on V vertices.

static Digraph 
rootedOutDAG(int V,
int E) 
Returns a random rootedout DAG on V vertices and E edges.

static Digraph 
rootedOutTree(int V) 
Returns a random rootedout tree on V vertices.

static Digraph 
simple(int V,
double p) 
Returns a random simple digraph on V vertices, with an
edge between any two vertices with probability p.

static Digraph 
simple(int V,
int E) 
Returns a random simple digraph containing V vertices and E edges.

static Digraph 
strong(int V,
int E,
int c) 
Returns a random simple digraph on V vertices, E
edges and (at most) c strong components.

static Digraph 
tournament(int V) 
Returns a random tournament digraph on V vertices.

public DigraphGenerator()
public static Digraph random(int V, int E)
public static Digraph simple(int V, int E)
V
 the number of verticesE
 the number of verticesjava.lang.IllegalArgumentException
 if no such simple digraph existspublic static Digraph simple(int V, double p)
V
 the number of verticesp
 the probability of choosing an edgejava.lang.IllegalArgumentException
 if probability is not between 0 and 1public static Digraph complete(int V)
V
 the number of verticespublic static Digraph dag(int V, int E)
V
 the number of verticesE
 the number of verticesjava.lang.IllegalArgumentException
 if no such simple DAG existspublic static Digraph tournament(int V)
V
 the number of verticespublic static Digraph rootedInDAG(int V, int E)
V
 the number of verticesE
 the number of edgespublic static Digraph rootedOutDAG(int V, int E)
V
 the number of verticesE
 the number of edgespublic static Digraph rootedInTree(int V)
V
 the number of verticespublic static Digraph rootedOutTree(int V)
V
 the number of verticespublic static Digraph path(int V)
V
 the number of vertices in the pathpublic static Digraph binaryTree(int V)
V
 the number of vertices in the binary treepublic static Digraph cycle(int V)
V
 the number of vertices in the cyclepublic static Digraph strong(int V, int E, int c)
V
 the number of verticesE
 the number of edgesc
 the (maximum) number of strong componentsjava.lang.IllegalArgumentException
 if c is larger than Vpublic static void main(java.lang.String[] args)