topologicalOrder
Returns modules in topological order (dependencies before dependents). Throws IllegalStateException if the graph contains cycles. Uses Kahn's algorithm (BFS-based) for deterministic ordering.
Only main (non-test) edges are considered - consistent with fanIn/fanOut.