Questions on Topological Sorting Currently learning about topological sorting.
My teacher gave us this problem.



The answer given to us is : B,A,C,E,D,G,F,H in lexicographical order.

Why does the order go from B,A,C THEN go to E and then D IF it is in lexicographical order?
Also, can another topological sort of this graph be: B,A,C,D,E,G,F,H?
The comments are right. In a topological sort, we start with nodes that have no incoming arrows and remove them from the graph, so to speak. In this case, if there are multiple possible nodes to remove, then we want to remove them in lexicographical order. Hence, the order should be $B, A, C, D, E , F, G, H$.

Your suggest topological sort does not work. This is because you propose to put $G$ before $F$.