title: Edge classification in a DFS
body: <p>According to the book (Intro to Algorithm), in dfs, edges are classified as 4 kinds:</p>
  
  <ol>
  <li>Tree Edge, if in edge (u,v), v is first discovered, then (u, v) is
  a tree edge.</li>
  <li>Back Edge, if ......, v is discovered already and v is an ancestor, then it's a back edge.</li>
  <li>Forward Edge, if ......, v is discovered already and v is a descendant of u, forward edge it is.</li>
  <li>Cross Edge, all edges except for the above three.</li>
  </ol>
  
  <p>My question is how can I identify whether v is u's ancestor or descendant when I'm trying to figure out if (u, v) is a back or forward edge?</p>