4 ms·
In what kind of situations do you use topological sort? I can't think of any scenario where I would use it leading me to think that there are problems I could s
by Monkeyget 16y ago
In what kind of situations do you use topological sort?
I can't think of any scenario where I would use it leading me to think that there are problems I could solve more easily by thinking of them as graph problems.
- jfb 16y agoI've used it to drive a bunch of independent makefiles, when I didn't need an overarching makefile. I've used it to sort dependencies in a simple work queue thing I wrote in the shell. It's not generally all that useful, but being able to grab it and do a quick tsort on paired strings is significantly less painful than writing a Python or Scheme script to do it, and it fits neatly into a pipeline.
- silentbicycle 16y agoI wrote a simple (http://github.com/silentbicycle/wn http://github.com/silentbicycle/wn) to-do graph analyzer for exactly that. I got sick of analyzing "I have to do X, but X needs Y and Z, and Z needs A, and ..." dependency charts. I'm comfortable with BSD make, but sometimes clients give hairy dependency graphs.