ptolemy.graph.analysis
Class ClusterNodesAnalysis

java.lang.Object
  extended by ptolemy.graph.analysis.Analysis
      extended by ptolemy.graph.analysis.ClusterNodesAnalysis

public class ClusterNodesAnalysis
extends Analysis

Given a collection of nodes in a graph, replace the subgraph induced by the nodes with a single node N. Each edge that connects a node Z outside the subgraph a node inside the subgraph is replaced by an edge (with the same edge weight, if there is one) that connects Z to N. Return the subgraph that is replaced; that is, return the subgraph induced by the given collection of nodes.

Since:
Ptolemy II 4.0
Version:
$Id: ClusterNodesAnalysis.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Shahrooz Shahparnia based on a file by Shuvra S. Bhattacharyya and Ming-Yung Ko
See Also:
Graph
Accepted Rating:
Red (ssb)
Proposed Rating:
Red (shahrooz)

Constructor Summary
ClusterNodesAnalysis(ClusterNodesTransformer analyzer)
          Construct an instance of this class with a given analyzer.
ClusterNodesAnalysis(Graph graph, java.util.Collection nodeCollection, Node superNode)
          Construct an instance of this class for a given graph.
 
Method Summary
 Graph clusterNodes()
          Return the clustered Graph.
 java.lang.String toString()
          Return a description of the analysis and the associated analyzer.
 boolean validAnalyzerInterface(Analyzer analyzer)
          Check if a given analyzer is compatible with this analysis.
 
Methods inherited from class ptolemy.graph.analysis.Analysis
analyzer, changeAnalyzer, graph, valid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClusterNodesAnalysis

public ClusterNodesAnalysis(Graph graph,
                            java.util.Collection nodeCollection,
                            Node superNode)
Construct an instance of this class for a given graph. Given a collection of nodes in a graph, replace the subgraph induced by the nodes with a single node N. Each edge that connects a node Z outside the subgraph a node inside the subgraph is replaced by an edge (with the same edge weight, if there is one) that connects Z to N. Return the subgraph that is replaced; that is, return the subgraph induced by the given collection of nodes.

Parameters:
graph - The graph.
nodeCollection - The collection of nodes.
superNode - The node that replaces the subgraph.

ClusterNodesAnalysis

public ClusterNodesAnalysis(ClusterNodesTransformer analyzer)
Construct an instance of this class with a given analyzer.

Parameters:
analyzer - The default Analyzer.
Method Detail

clusterNodes

public Graph clusterNodes()
Return the clustered Graph.

Returns:
Return the clustered Graph.

toString

public java.lang.String toString()
Return a description of the analysis and the associated analyzer.

Overrides:
toString in class Analysis
Returns:
A description of the analysis and the associated analyzer.

validAnalyzerInterface

public boolean validAnalyzerInterface(Analyzer analyzer)
Check if a given analyzer is compatible with this analysis. In other words if it is possible to use it to compute the computation associated with this analysis.

Overrides:
validAnalyzerInterface in class Analysis
Parameters:
analyzer - The given analyzer.
Returns:
True if the given analyzer is valid for this analysis.