Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8254183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:06:27+00:00 2026-06-08T01:06:27+00:00

Does anyone know of a random algorithm for generating a topological sort of a

  • 0

Does anyone know of a random algorithm for generating a topological sort of a DAG, where each invocation of the algorithm has a non-zero probability of generating every valid topological sort of the DAG.

It’s crucial that the algorithm does not preclude any valid topological sort, because it’s part of a larger algorithm that, given enough iterations, must be demonstrably capable of exploring all topological sorts of a given DAG.

Does anyone know if such an algorithm has been developed?

(Alternatively, if anyone knows of a reasonably efficient algorithm that’s guaranteed to generate all topological sorts of a given DAG, I can probably tweak that to get what I need.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:06:29+00:00Added an answer on June 8, 2026 at 1:06 am

    It helps to think in terms of what it means to say that you cover all possible topological sorts. During the topological sort, there is a point where you select a candidate to process from a subset of valid candidates, each of which is a valid choice. Depending on the way you implement the TS, it could be edge to follow from a set of edges each of which is a candidate (set of outgoing edges) or which node to select as the starting point (set of sinks/sources) or the randomly chosen start node.

    What you want is to ensure that the selection process produces a distribution which does not show an overwhelming biased towards a particular subset of the candidates.

    You can bias your selection process to achieve a more uniform distribution without running for infinite time. For example, you can assign a weight to each candidate of a set. Every time a candidate is selected you reduce the weight of that candidate by an amount “X” and increase the weight of the other candidates by an amount “X/(k-1)” where k is the size of the set of candidate set. This will result in a greater chance that a candidate which was not selected is selected in the next iteration, and result in a quicker convergence to a more uniform distribution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

does anyone know how to make a non-sequential random number generator in javascript? I
Does anyone know if a site (even non-Microsoft), that has details on COMExceptions/HRESULTS. When
Does anyone know why the following random distributions of matrices generate different plots? (This
Does anyone know why the following script works? #a-random-junk-string echo HI The shell executes
Just a random question but does anyone know the formula for how a timestamp
Does anyone know the name of a codec that can translate any random assortment
does anyone know a simple way to generate a random 64 bit number using
Does anyone know of a signing algorithm that will work with all these platforms.
Does anyone know of a way to generate a RNGCryptoServiceProvider-like random number in T-SQL
Does anyone know the original rationale, or story, of the different platforms each choosing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.