mapss.dif.bdf
Class BDFGraph

java.lang.Object
  extended by mocgraph.Graph
      extended by mocgraph.DirectedGraph
          extended by mapss.dif.DIFGraph
              extended by mapss.dif.bdf.BDFGraph
All Implemented Interfaces:
java.lang.Cloneable

public class BDFGraph
extends DIFGraph

Information associated with an BDF graph. This class caches frequently-used data associated with BDF graphs. It also provides methods to calculate BDF related statistics.

BDFGraph nodes and edges have weights in BDFNodeWeight and BDFEdgeWeight, respectively.

Version:
$Id: BDFGraph.java 409 2007-05-13 19:47:16Z plishker $
Author:
Chia-Jui Hsu
See Also:
BDFEdgeWeight, BDFNodeWeight

Constructor Summary
BDFGraph()
          Construct an empty BDF graph.
BDFGraph(int nodeCount)
          Construct an empty BDF graph with enough storage allocated for the specified number of nodes.
BDFGraph(int nodeCount, int edgeCount)
          Construct an empty BDF graph with enough storage allocated for the specified number of edges, and number of nodes.
 
Method Summary
 int[][] computePureTopologyMatrix()
          Compute topologyMatrix without adjusting probabilities of boolean edges.
 java.util.HashMap computeStatisticRepetitions()
          Compute statistical repetitions according to probabilities of boolean nodes.
 ptolemy.math.Fraction[][] computeStatisticTopologyMatrix()
          Compute topologyMatrix and adjust boolean edge's rate with given probabilities.
 boolean validEdgeWeight(java.lang.Object weight)
          Verify edge weight for BDF graph.
 boolean validNodeWeight(java.lang.Object weight)
          Verify node weight for BDF graph.
 
Methods inherited from class mapss.dif.DIFGraph
_getAttributeContainer, _registerEdge, _registerNode, _removeAttributeContainer, _removeReferenceFromAttributes, _setAttributeContainer, addEdge, addEdge, equals, getAttribute, getAttribute, getAttributeByContent, getAttributeByContent, getAttributeDescriptions, getAttributeDescriptions, getAttributeNames, getAttributeNames, getAttributes, getAttributes, getAttributesByContent, getAttributesByContent, getEdge, getName, getName, getNode, getObject, getParameter, getParameterNames, getParameters, hashCode, hideEdge, mergeGraph, mirror, mirror, removeAllAttributes, removeAllAttributes, removeAttribute, removeAttribute, removeAttribute, removeAttribute, removeEdge, removeNode, removeParameter, restoreEdge, setAttribute, setAttribute, setName, setName, setParameter, subgraph, subgraph
 
Methods inherited from class mocgraph.DirectedGraph
_connect, _connectedSubGraph, _disconnect, _initializeAnalyses, backwardReachableNodes, backwardReachableNodes, backwardReachableNodes, backwardReachableNodes, cycleNodeCollection, cycleNodes, edgeExists, edgeExists, inputEdgeCount, inputEdges, isAcyclic, outputEdgeCount, outputEdges, predecessorEdges, predecessors, reachableNodes, reachableNodes, reachableNodes, reachableNodes, sccDecomposition, selfLoopEdgeCount, sinkNodeCount, sinkNodes, sourceNodeCount, sourceNodes, subgraphs, successorEdges, successors, toDirectedAcyclicGraph, topologicalSort, topologicalSort, transitiveClosure
 
Methods inherited from class mocgraph.Graph
_addEdge, _connectEdge, _disconnectEdge, _emptyGraph, _registerChange, addAnalysis, addEdge, addEdge, addEdge, addEdges, addGraph, addNode, addNode, addNodes, addNodeWeight, addNodeWeights, changeCount, clone, cloneAs, connectedComponents, containsEdge, containsEdgeWeight, containsNode, containsNodeWeight, edge, edge, edgeCount, edgeLabel, edgeLabel, edges, edges, edges, edgeWeight, hidden, hiddenEdgeCount, hiddenEdges, incidentEdgeCount, incidentEdges, neighborEdges, neighbors, node, node, nodeCount, nodeLabel, nodeLabel, nodes, nodes, nodes, nodeWeight, selfLoopEdgeCount, selfLoopEdges, selfLoopEdges, toString, validateWeight, validateWeight, validateWeight, validateWeight, weightArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BDFGraph

public BDFGraph()
Construct an empty BDF graph.


BDFGraph

public BDFGraph(int nodeCount)
Construct an empty BDF graph with enough storage allocated for the specified number of nodes.

Parameters:
nodeCount - The number of nodes.

BDFGraph

public BDFGraph(int nodeCount,
                int edgeCount)
Construct an empty BDF graph with enough storage allocated for the specified number of edges, and number of nodes.

Parameters:
nodeCount - The integer specifying the number of nodes
edgeCount - The integer specifying the number of edges
Method Detail

computePureTopologyMatrix

public int[][] computePureTopologyMatrix()
Compute topologyMatrix without adjusting probabilities of boolean edges. topologyMatrix[edgeLabel][nodeLabel] is the rate which node(nodeLabel) produce or consump on the edge(edgeLabel).

Returns:
A pure topology matrix.

computeStatisticTopologyMatrix

public ptolemy.math.Fraction[][] computeStatisticTopologyMatrix()
Compute topologyMatrix and adjust boolean edge's rate with given probabilities.

Returns:
A statistical topology matrix.
Throws:
java.lang.RuntimeException - If boolean edge does not connect to or from a boolean node or the probability of boolean node is not set.

computeStatisticRepetitions

public java.util.HashMap computeStatisticRepetitions()
Compute statistical repetitions according to probabilities of boolean nodes.

Returns:
A Hashmap with Node mapping to it's repetition.

validEdgeWeight

public boolean validEdgeWeight(java.lang.Object weight)
Verify edge weight for BDF graph.

Overrides:
validEdgeWeight in class DIFGraph
Parameters:
weight - The edge weight to verify.
Returns:
True if the given edge weight is valid for BDF graph.

validNodeWeight

public boolean validNodeWeight(java.lang.Object weight)
Verify node weight for BDF graph.

Overrides:
validNodeWeight in class DIFGraph
Parameters:
weight - The node weight to verify.
Returns:
True if the given node weight is valid for BDF graph.