All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tw.edu.ncnu.im.cnclab.JGAP.GraphRandomizer

java.lang.Object
   |
   +----tw.edu.ncnu.im.cnclab.JGAP.GraphRandomizer

public class GraphRandomizer
extends Object
The GraphRandomizer class can use to randomize a custom graph.

Folowing parameters can be used to randomize the graph.

Version:
0.4 Jul 8, 1999
Author:
Ding-Yi Chen
See Also:
Graph

Variable Index

 o canvasHeight
Indicated the height of canvas.
 o canvasWidth
Indicated the width of canvas.
 o directed
Indicated whether graph directed.
 o r
The Random.
 o selfLooped
Indicated whether graph allows the self-loop.

Constructor Index

 o GraphRandomizer(Dimension)
Constructor of GraphRandomizer.

Method Index

 o generate(int)
Generate a randomized graph.
 o generate(int, double)
Generate a randomized graph.
 o generate(int, double, double, double)
Generate a randomized graph.
 o generate(int, double, double, double, boolean)
Generate a randomized graph.
 o generate(int, double, double, double, boolean, boolean)
Generate a randomized graph.
 o generateEdges(Graph, int, double, double, double)
Randomly generate the edge.
 o generateVertices(Graph, int)
Randomly place the vertices.

Variables

 o r
 protected Random r
The Random.

 o canvasWidth
 protected int canvasWidth
Indicated the width of canvas.

 o canvasHeight
 protected int canvasHeight
Indicated the height of canvas.

 o directed
 protected boolean directed
Indicated whether graph directed.

 o selfLooped
 protected boolean selfLooped
Indicated whether graph allows the self-loop.

Constructors

 o GraphRandomizer
 public GraphRandomizer(Dimension d)
Constructor of GraphRandomizer.

Parameters:
d - the size of the canvas which graphs be drawn on.

Methods

 o generate
 public Graph generate(int verts)
Generate a randomized graph.

Parameters:
verts - the number of vertices of the graph.
Returns:
the generated graph.
 o generate
 public Graph generate(int verts,
                       double density)
Generate a randomized graph.

Parameters:
verts - the number of vertices of the graph.
density - the probability of edge appear between vertices.
Returns:
the generated graph.
 o generate
 public Graph generate(int verts,
                       double density,
                       double lowerBound,
                       double upperBound)
Generate a randomized graph.

Parameters:
verts - the number of vertices of the graph.
density - the probability of edge appear between vertices.
lowerBound - the lower bound of edge weight.
upperBound - the upper bound of edge weight.
Returns:
the generated graph.
 o generate
 public Graph generate(int verts,
                       double density,
                       double lowerBound,
                       double upperBound,
                       boolean directed)
Generate a randomized graph.

Parameters:
verts - the number of vertices of the graph.
density - the probability of edge appear between vertices.
lowerBound - the lower bound of edge weight.
upperBound - the upper bound of edge weight.
directed - Indicate whether the graph directed
Returns:
the generated graph.
 o generate
 public Graph generate(int verts,
                       double density,
                       double lowerBound,
                       double upperBound,
                       boolean directed,
                       boolean selfLooped)
Generate a randomized graph.

Parameters:
verts - the number of vertices of the graph.
density - the probability of edge appear between vertices.
lowerBound - the lower bound of edge weight.
upperBound - the upper bound of edge weight.
directed - indicate whether the graph directed
selfLooped - allows the self-loop.
Returns:
the generated graph.
 o generateVertices
 protected void generateVertices(Graph graph,
                                 int verts)
Randomly place the vertices.

Parameters:
graph - the graph
verts - the number of vertices of the graph.
 o generateEdges
 protected void generateEdges(Graph graph,
                              int verts,
                              double density,
                              double lowerBound,
                              double upperBound)
Randomly generate the edge.

Parameters:
graph - the graph
verts - the number of vertices of the graph.
density - the probability of edge appear between vertices.
lowerBound - the lower bound of edge weight.
upperBound - the upper bound of edge weight.

All Packages  Class Hierarchy  This Package  Previous  Next  Index