Stable topological sort in graph_tool

Hi, list. Lets call a topological sort of a graph stable, if it preserves
some total ordering of nodes, if the topological order for these nodes is
not defined. The StackOverflow question [1] captures the problem, and the
pshufb's answer seems correct to me.

How would you implement such a sort using graph_tool, which AFAIK has only
an "unstable" version? Would it be possible to run 'topological_sort' on a
copied graph with additional edges in it?

BR,
Sergey

[1] https://stackoverflow.com/questions/11230881/stable-topological-sort

attachment.html (770 Bytes)