public class TransitiveReduction extends Object
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
| Modifier and Type | Field and Description |
|---|---|
static TransitiveReduction |
INSTANCE
Singleton instance.
|
| Modifier and Type | Method and Description |
|---|---|
<V,E> void |
reduce(DirectedGraph<V,E> directedGraph)
This method will remove all transitive edges from the graph passed as input parameter.
|
public static final TransitiveReduction INSTANCE
public <V,E> void reduce(DirectedGraph<V,E> directedGraph)
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 !
}
V - the graph vertex typeE - the graph edge typedirectedGraph - the directed graph that will be reduced transitivelyCopyright © 2016. All rights reserved.