Class CycleFinder<T>
- java.lang.Object
-
- com.yahoo.container.di.componentgraph.cycle.CycleFinder<T>
-
public class CycleFinder<T> extends Object
Applies the three-color algorithm to detect a cycle in a directed graph. If there are multiple cycles, this implementation only detects one of them and does not guarantee that the shortest cycle is found.
- Author:
- gjoranv
-
-
Constructor Summary
Constructors Constructor Description CycleFinder(Graph<T> graph)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<T>
findCycle()
Returns a list of vertices constituting a cycle in the graph, or an empty list if no cycle was found.
-