|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.hawaii.ics.yucheng.GraphRandomizer
class GraphRandomizer
A class that generates random graphs.
Constructor Summary | |
---|---|
GraphRandomizer()
|
Method Summary | |
---|---|
private static void |
buildDeepSubtrees(int[] indices,
int root,
int end,
java.util.Collection<Edge> edges)
Builds a random number of subtrees into the graph recursively. |
private static void |
buildLoops(java.util.Collection<Edge> edges,
int numVertices)
Builds a random number of loops into the graph. |
private static java.util.Collection<Edge> |
buildSubtrees(int[] indices)
Builds a random number of subtrees into the graph. |
static Graph |
create(int min,
int max)
Creates a random, valid graph with a number of vertices between min and (max - 1). |
private static int |
random(int low,
int high)
Returns a random number between low and high. |
private static void |
swap(int[] array,
int a,
int b)
Swaps two values in an array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
GraphRandomizer()
Method Detail |
---|
private static void buildDeepSubtrees(int[] indices, int root, int end, java.util.Collection<Edge> edges)
indices
- The vertex indices.root
- The root index of the tree.end
- The end index (not assigned in this method)edges
- The collection of edges.private static void buildLoops(java.util.Collection<Edge> edges, int numVertices)
edges
- The collection of edges.numVertices
- The number of vertices.private static java.util.Collection<Edge> buildSubtrees(int[] indices)
indices
- The vertex indices.
public static Graph create(int min, int max)
min
- The minimum number of vertices (inclusive).max
- The maximum number of vertices (exclusive).
private static int random(int low, int high)
low
- The low value (inclusive).high
- The high value (exclusive).
private static void swap(int[] array, int a, int b)
array
- The array.a
- The first index.b
- The second index.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |