in my work with explicit topological ordering under the presence of loops, i figured this out:

topological ordering is the same as partial ordering. so for two nodes `{a,b}`, when `a -> b`, then `a < b`.

with cyclical dependencies, this no longer makes sense under a linear partial order. if `a -> b, b -> a`, then `a < b < a`.

we need cyclic partial ordering, which is based on cyclic order (https://en.wikipedia.org/wiki/Cyclic_order). now we can express this after all, as `[a, b, a]`.

#devlog

Cyclic order - Wikipedia

@lritter AFAIK, you build the strongly connected components with an algorithm like Tarjan, which gives you the topological tree of cycles as a byproduct. Tarjan is one of the most beautiful Algos out there. 😍

@yesbait been there done that, and it's insufficient. strongly connected components are soup.

the graph below counts as one single SCC even though we can clearly see it has a substructure. no SCC algorithm can catch this relationship.

@lritter So, once you have an SCC, you are looking for all circular orders within it. Correct?
I am wondering if this could be computed as possible side-effect while the algo traverses the tree.
@yesbait another complication is that there is no canonical way to nest loops just from the graph description. the designer has to encode a preference somehow.