title: Topological sorting algorithms
body: <p>I am building a dependency based scheduler where my tasks/nodes form a directed acyclic graph. I have the following constraints and am trying to decide on the most appropriate algorithm:</p>
  
  <ol>
  <li>New tasks can be added (with or without dependencies) at any time</li>
  <li>Some tasks can run in parallel</li>
  </ol>
  
  <p>Two algorithms are mentioned repeatedly with regards to topological sorting; depth first search and Kahn's algorithm. </p>
  
  <ul>
  <li>What are the pro's and con's of these two algorithms?</li>
  <li>Is one algorithm objectively better for my scenario?</li>
  <li>Is there an alternate that better fits my scenario?</li>
  </ul>
  
  <p>I have one further question about vocabulary. Given dependencies such as:</p>
  
  <pre><code>c-&gt;b
  b-&gt;a
  e-&gt;d
  </code></pre>
  
  <p>Is this considered to be a single directed acyclic graph, 2 acyclic graphs (since e and d are not dependent on the other tasks) or an acyclic graph with sub acyclic graphs?</p>