Click or drag to resize

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.Algorithms
Assembly:  SD.Tools.Algorithmia (in SD.Tools.Algorithmia.dll) Version: 1.3.3.0 (1.3.18.0209)
Syntax
protected override bool CycleDetected(
	TVertex relatedVertex,
	HashSet<TEdge> edges
)

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