Topological Sort - A mechanism for sorting DAGs
Topological sort is used to sort Directed Acyclic Graphs (DAGs) is a linear ordering of sorting the
nodes such that each node comes before its children. Each DAG has atleast one topological sort
sort, but may have many.
This has many applications: (i) - (iii) from wikipedia
(a) makefile
(b) instruction scheduling
(c) formula-cell evaluation in spread sheets
(d) deep commit in DPL
To find the topological sort ordering - (i) Put all the nodes without any incoming edges into the queue; (ii) For each node in the queue trace the edges and add the nodes if it is entirely seperated from the DAG.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home