Transitive reduction

Simplify a diagram by removing arrows you can already follow another way. If task three needs task two and task two needs task one, you can erase the arrow from one to three without changing the order you must follow.

For each arrow try leaving through a different neighbor. If the destination is still reachable, the direct arrow is redundant. The graph must be acyclic.

Using Warshall’s table takes O(V³) time and O(V²) space.