New answers tagged

0

If you represent the DAG as an adjacency list, where each node links to all of its predecessors, you can find all predecessors by iterating over that list. If you represent the DAG as an adjacency list, where each node links to all of its successors, you can easily construct a list of predecessors in a linear-time (iterate over all nodes and all successor ...


Top 50 recent answers are included