I am aware of the topological sorting and strongly connected components are very related algorithms, but I have been looking for an algorithm to compute both instead of one at a time, and I find it surprisingly difficult.
With the assumption of a directed acyclic graph, can one simultaneously find the list of strongly connected components and at the same time topologically sort the nodes in each of the components?
For clarity, the output would be a list of components, with each component being a topological order of the nodes included in that component.
Bonus points when the list of strongly connected components is sorted by the insertion order of the nodes in the graph (that is, the first connected component contains the first node ever inserted in the graph) regardless of global topological order; etc. for subsequent components).