title: Why is Depth-First Search said to suffer from infinite loops?
body: <p>I have read about <a href="http://en.wikipedia.org/wiki/Depth-first_search" rel="noreferrer">DFS</a> and <a href="http://en.wikipedia.org/wiki/Breadth-first_search" rel="noreferrer">BFS</a> many times but I have this doubt lingering my mind since long. In a lot of articles it is mentioned that DFS can get stuck in infinite loops.</p>
  
  <p>As far as I know, this limitation can easily be removed by keeping track of the visited nodes. In fact, in all the books that I have read, this little check is a part of DFS. </p>
  
  <p>So why are 'infinite loops' mentioned as a disadvantage of DFS? Is it just because the original DFS algorithm did not have this check for visited nodes? Please explain.</p>