implementation of directed acyclic graph traversal
look at executionOrderV1 and V2 test for two algorithms