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.
-
verts : the number of vertices in the graph.
-
density : the probability of edge appear between vertices. (Default :0.2)
-
lowerBound : the lower bound of edge weight. (Default: 0.0)
-
upperBound : the upper bound of edge weight. (Default:100.0)
-
directed : indicate the directed graph. (Default:true)
-
selfLooped : indicate the directed graph. (Default:false)
- Version:
- 0.4 Jul 8, 1999
- Author:
- Ding-Yi Chen
- See Also:
- Graph
-
canvasHeight
- Indicated the height of canvas.
-
canvasWidth
- Indicated the width of canvas.
-
directed
- Indicated whether graph directed.
-
r
- The Random.
-
selfLooped
- Indicated whether graph allows the self-loop.
-
GraphRandomizer(Dimension)
- Constructor of GraphRandomizer.
-
generate(int)
- Generate a randomized graph.
-
generate(int, double)
- Generate a randomized graph.
-
generate(int, double, double, double)
- Generate a randomized graph.
-
generate(int, double, double, double, boolean)
- Generate a randomized graph.
-
generate(int, double, double, double, boolean, boolean)
- Generate a randomized graph.
-
generateEdges(Graph, int, double, double, double)
- Randomly generate the edge.
-
generateVertices(Graph, int)
- Randomly place the vertices.
r
protected Random r
- The Random.
canvasWidth
protected int canvasWidth
- Indicated the width of canvas.
canvasHeight
protected int canvasHeight
- Indicated the height of canvas.
directed
protected boolean directed
- Indicated whether graph directed.
selfLooped
protected boolean selfLooped
- Indicated whether graph allows the self-loop.
GraphRandomizer
public GraphRandomizer(Dimension d)
- Constructor of GraphRandomizer.
- Parameters:
- d - the size of the canvas which graphs be drawn on.
generate
public Graph generate(int verts)
- Generate a randomized graph.
- Parameters:
- verts - the number of vertices of the graph.
- Returns:
- the generated graph.
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.
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.
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.
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.
generateVertices
protected void generateVertices(Graph graph,
int verts)
- Randomly place the vertices.
- Parameters:
- graph - the graph
- verts - the number of vertices of the graph.
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