title: DFS infinite loop
body: <p>I'm not getting the idea that DFS is not complete because it could stuck in infinite loops.</p>
  
  <p>Here is an answer from another question</p>
  
  <blockquote>
    <p>If the graph has cycles, then a depth first search could get stuck in
    a cycle before finding the desired element.</p>
  </blockquote>
  
  <p>And this answer is the same as in my AI book. But in my Algorithms book i'm pretty sure DFS never goes into an infinite cycles, because an explored node it will be marked as visited, so that the algorithm well never reinsert it in the stack again?</p>
  
  <p>Please correct me if i'm wrong ?</p>