|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmapss.dif.DIFRandomGraphGenerator
public class DIFRandomGraphGenerator
Random graph generator in generating random DIF graphs. The generator
makes random topology only. Parameters like production rates, consumption
rates, and delays are to be determined in the specific class of dataflow.
After the object instanciation, every call to #graph()
generates
a new graph with the same node count. Therefore, multiple random graphs
can be obtained with only one time object creation.
Field Summary | |
---|---|
protected DIFGraph |
_graph
The random graph. |
protected boolean[][] |
_incidence
Incidence matrix. |
protected boolean[][] |
_reachability
Reachability matrix. |
Constructor Summary | |
---|---|
DIFRandomGraphGenerator()
Null constructor. |
Method Summary | |
---|---|
protected void |
_initialize()
Initialize the generator. |
protected void |
_initialize(DIFGraph graph,
java.lang.Object nodeWeight,
java.lang.Object edgeWeight)
Initialize the generator. |
protected boolean |
_isIncident(mocgraph.Node source,
mocgraph.Node sink)
Check the existence of an edge connecting the source to the sink. |
protected boolean |
_isReachable(mocgraph.Node source,
mocgraph.Node sink)
Check the existence of any path from the source to the sink. |
protected void |
_makeDAG(int density)
Make a radom Directed Acyclic Graph (DAG). |
protected int |
_randomNonNegativeInt(int upperBound)
Return a random non-negative integer for a given bound. |
protected void |
_reset(int nodeCount)
Reset all configurations to generate a new random graph. |
DIFGraph |
graph(int nodeCount)
Generate a random DIF graph with the given node count. |
DIFGraph |
graph(int minNodes,
int maxNodes)
Generate a random DIF graph with the given node count range.Node count is automatically set to 2 in the implementation if the given minimum count is less than 2. |
DIFGraph[] |
graphs(int minNodes,
int maxNodes,
int graphCount)
Generate a bunch of DIF graphs. |
void |
setMaxFanIn(int maxFanIn)
Set the maximal number of edges that can fan into each node. |
void |
setMaxFanOut(int maxFanOut)
Set the maximal number of edges that can fan out of each node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DIFGraph _graph
protected boolean[][] _reachability
protected boolean[][] _incidence
Constructor Detail |
---|
public DIFRandomGraphGenerator()
Method Detail |
---|
public DIFGraph graph(int nodeCount)
nodeCount
- The desired node count.
DIFGraph
.public DIFGraph graph(int minNodes, int maxNodes)
minNodes
- The minimal node count.maxNodes
- The maximal node count.
DIFGraph
.public DIFGraph[] graphs(int minNodes, int maxNodes, int graphCount)
minNodes
- The minimal node count.maxNodes
- The maximal node count.graphCount
- The desired number of random graphs.
public void setMaxFanIn(int maxFanIn)
maxFanIn
- The maximal number of fan-in edges.public void setMaxFanOut(int maxFanOut)
maxFanOut
- The maximal number of fan-out edges.protected void _initialize()
protected void _initialize(DIFGraph graph, java.lang.Object nodeWeight, java.lang.Object edgeWeight)
graph
- The desired dataflow graph type.nodeWeight
- The desired node weight type.edgeWeight
- The desired edge weight type.protected boolean _isIncident(mocgraph.Node source, mocgraph.Node sink)
DirectedGraph.edgeExists(Node, Node)
. However,
the implementation here is more efficient because an incidence matrix
is built along with the random graph generation process. Incidence
checking is through retrieving the matrix element rather than
a computation from the ground.
source
- The source node.sink
- The sink node.
protected boolean _isReachable(mocgraph.Node source, mocgraph.Node sink)
reachableNodes()
in DirectedGraph
.
The implementation here is through retreiving matrix elements rather
than a computation from the ground.
source
- The source node.sink
- The sink node.
protected void _makeDAG(int density)
The
- density of the number of edges.protected int _randomNonNegativeInt(int upperBound)
upperBound
- The upper bound (exclusive) of the random number.
protected void _reset(int nodeCount)
nodeCount
- The desired node count.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |