Class 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$
    Author:
    Shahrooz Shahparnia based on a file by Shuvra S. Bhattacharyya and Ming-Yung Ko
    See Also:
    Graph
    Pt.AcceptedRating:
    Red (ssb)
    Pt.ProposedRating:
    Red (shahrooz)
    • 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.