- java.lang.Object
-
- org.jgrapht.alg.TransitiveReduction
-
public class TransitiveReduction extends Object
An implementation of Harry Hsu's transitive reduction algorithm.This is a port from a python example by Michael Clerx, posted as an answer to a question about transitive reduction algorithm pseudocode on Stack Overflow
- Author:
- Christophe Thiebaud
-
-
Field Summary
Fields Modifier and Type Field Description static TransitiveReduction
INSTANCE
Singleton instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V,E>
voidreduce(Graph<V,E> directedGraph)
This method will remove all transitive edges from the graph passed as input parameter.
-
-
-
Field Detail
-
INSTANCE
public static final TransitiveReduction INSTANCE
Singleton instance.
-
-
Method Detail
-
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 typeE
- the graph edge type- Parameters:
directedGraph
- the directed graph that will be reduced transitively
-
-