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 and Description 

DigraphGenerator() 
Modifier and Type  Method and 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 
copy(Digraph G) 
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 
eulerianCycle(int V,
int E)
Returns an Eulerian cycle digraph on
V vertices. 
static Digraph 
eulerianPath(int V,
int E)
Returns an Eulerian path digraph on
V vertices. 
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 eulerianCycle(int V, int E)
V
vertices.V
 the number of vertices in the cycleE
 the number of edges in the cycleV
vertices
and E
edgesjava.lang.IllegalArgumentException
 if either V <= 0
or E <= 0
public static Digraph eulerianPath(int V, int E)
V
vertices.V
 the number of vertices in the pathE
 the number of edges in the pathV
vertices
and E
edgesjava.lang.IllegalArgumentException
 if either V <= 0
or E < 0
public 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)