Академический Документы
Профессиональный Документы
Культура Документы
DIGRAPH ALGORITHMS
Approach:
Graph contains cycle if there are any back edges. There are two
types of back edges as seen in the example above (marked in red)
• Edge from a vertex to itself. Self loop. (4-4)
• Edge from any descendent back to vertex.
4
3 3
2 1 1
0 0 0
Stack Stack Stack