[Task83] Graph Generator

Back to Problem Solutions forum

Cl3r1k     2017-03-10 09:58:13
User avatar

Hello! I'm a bit confused about this problem. Can someone clarify the example?

In the given example:

---Let us study an example. Suppose you are given N = 10 and X0 = 0. The first few numbers you'll get from random generator are:
700001 1821950 1967079 1537772 1336989 68938 2017283 809880 ...

In my case i have numbers from random generator are: 700001 1821950 1967079 1537772 1336989 68938 2017283 809880 386457 706902 <- the end (the amount of the numbers is 10 == N)

---After you apply formula Y = X % N + 1 to them they are transformed into: 2 1 10 3 10 9 4 1 8 3 2 1 6 7 8 1 4 3 6 5 8 ...

In my case i have transformed numbers: 2 1 10 3 10 9 4 1 8 3 <- the end (the amount of the numbers is 10 == N)

So, I don't understand where the author get the following numbers: 2 1 6 7 8 1 4 3 6 5 8 ...

Quandray     2017-03-10 15:17:26
User avatar

Hi,

N is the number of vertices, but the generator is being used to create the edges between those vertices, so you should not stop when you have generated N numbers. You will need two pairs of values for each vertex, so you will need 4xN numbers.

Cl3r1k     2017-03-14 08:56:26
User avatar

Thanks a lot for the idea!

vancea.vladimir     2018-05-16 19:06:31

Hello! Can anyone suggerst what is happining with random generator when we ara skipping one or both vertices ? And acctualy how are we skipping when first vertice is not good and second are good or ..

Please login and solve 5 problems to be able to post at forum