title: If topological sort uses DFS, how can it succeed on disconnected graphs?
body: <p>There's a gap in my knowledge but I'm not sure exactly where. Topological sorting can be done using depth first search, as <a href="https://en.wikipedia.org/wiki/Topological_sorting#Depth-first_search" rel="noreferrer">wikipedia explains</a>. However I've only seen depth first search implemented for trees, where as topological sort is for DAGs.</p>
  
  <ol>
  <li>is a tree a special case of a DAG where the implied direction of the edges is from the root node down</li>
  <li>is the algorithm used for topological sort not really doing DFS, only something a lot like it?</li>
  </ol>
  
  <p>For example, topological sort can handle disconnected graphs where as DFS cannot traverse a node with no edges connecting it...can it?</p>