public class DirectedAcyclicGraphVerifier
extends java.lang.Object
| Constructor and Description |
|---|
DirectedAcyclicGraphVerifier() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
addDependencies(Vertex vertex,
java.util.List vertices)
Recursively add a vertex and all of its dependencies to a list of
vertices
|
static void |
resetVertices(java.util.List vertices)
Resets all the vertices so that the visitation flags and indegrees are
reset to their start values.
|
static void |
topologicalSort(java.util.List vertices)
Sort a set of vertices so that no dependency is before its vertex.
|
static void |
verify(java.util.List vertices)
Verify a set of vertices and all their dependencies have no cycles.
|
static void |
verify(Vertex vertex)
Verify that a vertex and its set of dependencies have no cycles.
|
public static void verify(Vertex vertex) throws CyclicDependencyException
vertex - The vertex we want to test.CyclicDependencyException - if there is a cycle.private static void addDependencies(Vertex vertex, java.util.List vertices)
vertex - Vertex to be added.vertices - Existing list of vertices.public static void verify(java.util.List vertices)
throws CyclicDependencyException
vertices - The list of vertices we want to test.CyclicDependencyException - if there is a cycle.public static void topologicalSort(java.util.List vertices)
throws CyclicDependencyException
Implementation Detail: This particular algorithm is a more efficient variation of the typical Topological Sort algorithm. It uses a Queue (Linked List) to ensure that each edge (connection between two vertices) or vertex is checked only once. The efficiency is O = (|V| + |E|).
vertices - CyclicDependencyExceptionpublic static void resetVertices(java.util.List vertices)
vertices -