title: Kahn's algorithm vs DFS for course schedule leetcode
body: <p>Course Schedule leetcode: <a href="https://leetcode.com/problems/course-schedule/" rel="nofollow noreferrer">https://leetcode.com/problems/course-schedule/</a></p>
  <p>This problem involves detecting a cycle, and if there is one then you cannot complete all course.</p>
  <p>I've heard that DFS is most recommended for detecting a cycle, yet Kahn's Algorithm is recommended for the course schedule problem, which is a BFS solution.</p>
  <p>So.. which is it? Is DFS better for detecting cycles or is BFS?</p>