Module com.aoapps.hodgepodge
Package com.aoapps.hodgepodge.graph
Class SymmetricAcyclicGraphChecker<V,Ex extends Exception>
java.lang.Object
com.aoapps.hodgepodge.graph.SymmetricAcyclicGraphChecker<V,Ex>
- Type Parameters:
Ex
- An arbitrary exception type that may be thrown
- All Implemented Interfaces:
GraphChecker<Ex>
public class SymmetricAcyclicGraphChecker<V,Ex extends Exception>
extends Object
implements GraphChecker<Ex>
A symmetric directed acyclic graph checker.
- Author:
- AO Industries, Inc.
-
Constructor Summary
ConstructorDescriptionSymmetricAcyclicGraphChecker
(SymmetricMultiGraph<V, ?, ? extends Ex> graph, boolean isForward) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Test the graph for cycles and makes sure that all connections are consistent with back connections.
-
Constructor Details
-
SymmetricAcyclicGraphChecker
-
-
Method Details
-
checkGraph
Test the graph for cycles and makes sure that all connections are consistent with back connections.Cycle algorithm adapted from: http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/GraphAlgor/depthSearch.htm http://www.eecs.berkeley.edu/~kamil/teaching/sp03/041403.pdf
In the case of a multigraph, any number of edges one direction is considered a match to any number of edges back. The number does not need to be equal.
- Specified by:
checkGraph
in interfaceGraphChecker<V>
- Throws:
AsymmetricException
- where the edges are not symmetricCycleException
- if there is a cycle in the graphEx
-