Skip to content

@graphty/algorithms / index / hasCycleDFS

Function: hasCycleDFS() ​

hasCycleDFS(graph): boolean

Defined in: algorithms/traversal/dfs.ts:165

Detect cycles in a graph using DFS

Parameters ​

graph ​

Graph

The input graph to check for cycles

Returns ​

boolean

True if the graph contains a cycle, false otherwise