Marc 'BlackJack' Rintsch wrote: >> So I suspect that this is a common problem for those familiar with >> partially ordered sets or directed graphs. I'm wondering if anyone else >> is familiar with this problem and knows an efficient algorithm that >> will solve it. It would be good if any such algorithm would be able to >> check for circular definitions in the input. > > You are looking for "topological sort". Feed a search engine with that > term. :-)
including "python" in the search request might be a good idea. here's a topsort in Python: http://mail.python.org/pipermail/python-list/1999-July/006660.html (note that most code in that module is for analyzing cycles in case the sort fails, not for the sort itself). </F> -- http://mail.python.org/mailman/listinfo/python-list