Skip to main content
1 of 7
Ian
  • 29
  • 3

How to find a random ring in a large graph?

Suppose we have a large directed graph, containing about 2000 nodes and about 10 edges per node. Now we need to achieve these goals as quickly as possible:

  1. Find a random ring in this graph. The 'Random' means no matter how big the ring is, all the possible rings should be picked with the same probabilities.

  2. After finding the random ring, we reverse this ring, which means this ring will be changed to another direction. Now how should we find a random ring on this new graph.

  3. The step 1 and step 2 can be invoked for many times, please find a proper way to store the graph and find a random ring easily.

Ian
  • 29
  • 3