Detect a cycle in a Graph
Last updated
Last updated
If graph is a tree, there must be n - 1 edges when vertex is n.
There must be a cycle if the number of edges is greater or equal to n
Count Edges
undirected only
DFS
both possible
directed - white/gray/black
undirected - true/false
Union Find - disjoint set
undirected only
no self loop