I am wondering if there is an algorithm for finding all topological sorts in the graph.

Closed due to the fact that the issue is too general for the participants user207618, Kromster , cheops , aleksandr barakin , Nicolas Chabanovsky ♦ Aug 24 '16 at 5:13 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • there may be about N !. I do not think that much faster than a frontal one in the worst case. - pavel

1 answer 1

Yes of course. Knut's “The Art of Programming ”, Volume 4A, on page 395 has an algorithm V — All Topological Sorts .

And generally, see section 7.2.1.2, on pp. 393-396.

  • one
    It is not the answer to the question. To leave your comments or ask the author to clarify, leave a comment to the appropriate post. - From the queue of checks - Ivan Pshenitsyn
  • @IvanPshenitsyn This is the most complete answer to the question. Is there an algorithm? Yes. There is a link to the eternal :), and not to the site. How do you imagine a more complete answer? How simple is the set of this algorithm? A couple of pages with formulas? I have no comment, but an extremely complete answer. I consider your remark an empty cavilier out of business :) - Harry
  • one
    @Harry would be better if a fragment of the article) I was wondering for its asymptotics I had to google - pavel