Class NormalisedIntComponents


  • public class NormalisedIntComponents
    extends java.lang.Object
    Assumes that the nodes are numbered [0..n].
    Author:
    sander
    • Constructor Detail

      • NormalisedIntComponents

        public NormalisedIntComponents​(int numberOfNodes)
      • NormalisedIntComponents

        public NormalisedIntComponents​(java.util.Collection<? extends gnu.trove.TIntCollection> partition)
    • Method Detail

      • mergeComponentsOf

        public void mergeComponentsOf​(int normalisedA,
                                      int normalisedB)
        Merge the components of the two nodes. If they are in the same component, runs in O(1). If they are not, runs in O(n) (n = number of nodes).
        Parameters:
        normalisedA -
        normalisedB -
      • mergeComponents

        public void mergeComponents​(int componentA,
                                    int componentB)
        Merge two components. The second component is kept.
        Parameters:
        componentA -
        componentB -
      • areInSameComponent

        public boolean areInSameComponent​(int normalisedA,
                                          int normalisedB)
      • getComponentOf

        public int getComponentOf​(int node)
      • getNumberOfComponents

        public int getNumberOfComponents()
      • getComponents

        public java.util.List<gnu.trove.set.TIntSet> getComponents()
      • getNodeIndicesOfComponent

        public java.lang.Iterable<java.lang.Integer> getNodeIndicesOfComponent​(int componentIndex)
      • normalise

        public int[] normalise()
        Put the components in increasing order 0...n
        Returns:
        The mapping from old component to new component.