I have DAG stored as an array. How can I assign priorities to the DAG in a way that parent node gets the highest priority and all leaf nodes the lowest priority?
If I have a DAG as following
A # A -> B,C # A
/ \ # B -> D -----> # B C //can be used in parallel
C B # C -> E # D
\ \ # D -> E # E
\ D # E ->
\ /
E
I have both parent and children stored in the array which I am using as DAG.
Topological Sort returns a linear list e.g. A,C,B,D,E
only.