• + 0 comments

    This is what helped me solved the problem. Read wikipedia Topological sort -> Kahn's algorithm. It should give you an idea how to go about it and what ordering to use within priority queue.