title: Algorithm for finding all critical paths
body: <p>I need to create an algorithm that could find all the critical paths in a graph.</p>
  
  <p>I have found the topological order of the nodes, calculated earliest end times and latest start times for each node.</p>
  
  <p>Also I have found all critical nodes (i.e. the ones that are on a critical path).</p>
  
  <p>The problem is putting it all together and actually printing out all these paths. If there is only 1 critical path in a graph, then I can deal with it but the issues start if there are multiple paths.</p>
  
  <p>For example one node being part of several critical paths, multiple start nodes, multiple end nodes and so on. I have not managed to come up with an algorithm that could take all of these factors into account.</p>
  
  <p>The output I am looking for is something like this (if a,b,c etc are all nodes):</p>
  
  <ul>
  <li>a->e</li>
  <li>a->c->f->i->j->k</li>
  <li>a->c->g</li>
  <li>l->e</li>
  </ul>
  
  <p>It would be nice if someone could write a description of an algorithm that could find the paths from knowing critical nodes, topological order, etc. Or maybe also in C or java code.</p>
  
  <p>EDIT:
  Here is an example, which should provide the output I posted earlier. Critical paths are red, the values of each node are marked above or near it.
  <img src="https://i.stack.imgur.com/4ZZRb.png" alt="Critical path"></p>