title: Sorting algorithms with requirements
body: <p>I am looking for an algorithm that can do sorting with requirements. As an example if I have 3 nodes N1, N2 and N3
  I have the requirement that N2 must come after N3, and N3 have the requirement that it must come after N1. So the correct sort will be N1, N3, N2.</p>