public class DigraphGenerator extends 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 |
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 void |
main(String[] args)
Unit tests the DigraphGenerator library.
|
static Digraph |
path(int V)
Returns a path digraph on V vertices.
|
static Digraph |
rootedInDAG(int V,
int E)
Returns a random rooted-in DAG on V vertices and E edges.
|
static Digraph |
rootedInTree(int V)
Returns a random rooted-in tree on V vertices.
|
static Digraph |
rootedOutDAG(int V,
int E)
Returns a random rooted-out DAG on V vertices and E edges.
|
static Digraph |
rootedOutTree(int V)
Returns a random rooted-out 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 least) c strong components.
|
static Digraph |
tournament(int V)
Returns a random tournament digraph on V vertices.
|
public static Digraph simple(int V, int E)
V - the number of verticesE - the number of verticesIllegalArgumentException - if no such simple digraph existspublic static Digraph simple(int V, double p)
V - the number of verticesp - the probability of choosing an edgeIllegalArgumentException - 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 verticesIllegalArgumentException - 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 componentsIllegalArgumentException - if c is larger than Vpublic static void main(String[] args)
Copyright © 2014. All Rights Reserved.