Class TransitiveReduction

java.lang.Object
org.jgrapht.alg.TransitiveReduction

public class TransitiveReduction extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final TransitiveReduction
    Singleton instance.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Private Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    <V, E> void
    reduce(Graph<V,E> directedGraph)
    This method will remove all transitive edges from the graph passed as input parameter.
    (package private) static void
    The matrix passed as input parameter will be transformed into a path matrix.
    (package private) static void
    The path matrix passed as input parameter will be transformed into a transitively reduced matrix.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • TransitiveReduction

      private TransitiveReduction()
      Private Constructor.
  • Method Details

    • transformToPathMatrix

      static void transformToPathMatrix(BitSet[] matrix)
      The matrix passed as input parameter will be transformed into a path matrix.

      This method is package visible for unit testing, but it is meant as a private method.

      Parameters:
      matrix - the original matrix to transform into a path matrix
    • transitiveReduction

      static void transitiveReduction(BitSet[] pathMatrix)
      The path matrix passed as input parameter will be transformed into a transitively reduced matrix.

      This method is package visible for unit testing, but it is meant as a private method.

      Parameters:
      pathMatrix - the path matrix to reduce
    • reduce

      public <V, E> void reduce(Graph<V,E> directedGraph)
      This method will remove all transitive edges from the graph passed as input parameter.

      You may want to clone the graph before, as transitive edges will be pitilessly removed.

      e.g.
       {
           @code DirectedGraph<V, T> soonToBePrunedDirectedGraph;
      
           TransitiveReduction.INSTANCE.reduce(soonToBePrunedDirectedGraph);
      
           // pruned !
       }
       
      Type Parameters:
      V - the graph vertex type
      E - the graph edge type
      Parameters:
      directedGraph - the directed graph that will be reduced transitively