Skip to content

Commit 6e66052

Browse files
authored
Updated Readme with Cycle Explanation
1 parent 194d668 commit 6e66052

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ Applications of Breadth First Search are :
4343

4444
And there are many more...
4545

46+
####Cycle Detection
47+
[Cycle (graph theory)](https://en.wikipedia.org/wiki/Cycle_(graph_theory))
48+
The existence of a cycle in directed and undirected graphs can be determined by whether depth-first search (DFS) finds an edge that points to an ancestor of the current vertex (it contains a back edge). All the back edges which DFS skips over are part of cycles. In an undirected graph, the edge to the parent of a node should not be counted as a back edge, but finding any other already visited vertex will indicate a back edge. In the case of undirected graphs, only O(n) time is required to find a cycle in an n-vertex graph, since at most n − 1 edges can be tree edges.
49+
50+
Many topological sorting algorithms will detect cycles too, since those are obstacles for topological order to exist. Also, if a directed graph has been divided into strongly connected components, cycles only exist within the components and not between them, since cycles are strongly connected.
51+
52+
For directed graphs, distributed message based algorithms can be used. These algorithms rely on the idea that a message sent by a vertex in a cycle will come back to itself. Distributed cycle detection algorithms are useful for processing large-scale graphs using a distributed graph processing system on a computer cluster (or supercomputer).
53+
54+
Applications of cycle detection include the use of wait-for graphs to detect deadlocks in concurrent systems.
55+
4656
WORK IN PROGRESS
4757

4858
## Classes Explanation

0 commit comments

Comments
 (0)