TopologicalSorterTVertex, TEdgeCycleDetected Method |
A cycle has been detected in a directed graph. This method is called to signal derived classes that the cycle has been detected, as the derived class
ordered this class to signal it if cycles were detected. Cycle checks are only performed on directed graphs.
Namespace: SD.Tools.Algorithmia.Graphs.AlgorithmsAssembly: SD.Tools.Algorithmia (in SD.Tools.Algorithmia.dll) Version: 1.2.0.0 (1.2.14.1118)
Syntax protected override bool CycleDetected(
TVertex relatedVertex,
HashSet<TEdge> edges
)
Protected Overrides Function CycleDetected (
relatedVertex As TVertex,
edges As HashSet(Of TEdge)
) As Boolean
Parameters
- relatedVertex
- Type: TVertex
The related vertex which formed the cycle. - edges
- Type: System.Collections.GenericHashSetTEdge
The edges used to visit the related vertex.
Return Value
Type:
Boolean
true if routines should proceed deeper into the graph, false otherwise (so traversing will stop at this point and backtrack with
other paths). Returning true could lead to infinite loops. Default is true
Remarks It's recommended you throw an exception to quit the operation entirely if your algorithm can't deal with cycles.
See Also