Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that random graph generators uses parameter seed #33579

Closed
dcoudert opened this issue Mar 27, 2022 · 25 comments
Closed

Ensure that random graph generators uses parameter seed #33579

dcoudert opened this issue Mar 27, 2022 · 25 comments

Comments

@dcoudert
Copy link
Contributor

We ensure that random graph generators use parameter seed, and we add this parameter if missing.

CC: @kliem @tscrim @vbraun

Component: graph theory

Author: David Coudert

Branch/Commit: 6cbdf91

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/33579

@dcoudert dcoudert added this to the sage-9.6 milestone Mar 27, 2022
@dcoudert
Copy link
Contributor Author

Branch: public/graphs/33579_random_seed

@dcoudert

This comment has been minimized.

@dcoudert
Copy link
Contributor Author

Commit: a7e1e54

@dcoudert
Copy link
Contributor Author

comment:1

This might break multiple doctests using random graphs.


New commits:

a7e1e54trac #33579: ensure random graph generators use parameter seed

@dcoudert
Copy link
Contributor Author

Author: David Coudert

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 27, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

26fe186trac #33579: fix some doctests

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 27, 2022

Changed commit from a7e1e54 to 26fe186

@dcoudert
Copy link
Contributor Author

comment:3

I'm not sure it's the right way to do it and I don't understand why some doctests have to be modified...

Also, we have some doctest errors in src/sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py that we will have to fix in the graphtheory.tex (I don't know where it is yet).

**********************************************************************
File "src/sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py", line 221, in sage.tests.books.computational-mathematics-with-sage\
math.graphtheory_doctest
Failed example:
    max(color.values()) + 1
Expected:
    6
Got:
    5
**********************************************************************
File "src/sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py", line 226, in sage.tests.books.computational-mathematics-with-sage\
math.graphtheory_doctest
Failed example:
    P = Permutations([0,1,2,3]); P.random_element()
Expected:
    [2, 0, 1, 3]
Got:
    [3, 2, 1, 0]
**********************************************************************
...

@tscrim
Copy link
Collaborator

tscrim commented Mar 27, 2022

comment:4

My guess as to why doctests are needed to be changed is current_randstate() is not called as often. So all of those doctests that are depending on a specific state are changed. The 32-bit tests will also need to be updated.

For those book tests, you are using a different method of constructing the seed I believe. Hence, it is doing something on a different graph and changing the seed in a different way for the second doctest. So these are essentially trivial failures.

@dcoudert
Copy link
Contributor Author

comment:5

For those book tests, you are using a different method of constructing the seed I believe. Hence, it is doing something on a different graph and changing the seed in a different way for the second doctest. So these are essentially trivial failures.

I agree these are trivial failures, but I don't know where is to tex file to correct.

@tscrim
Copy link
Collaborator

tscrim commented Mar 27, 2022

comment:6

I don't know where the tex file is either. Perhaps we can cc (or directly email?) some of the authors to ask?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 5, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

f0e7684trac #33579: Merged with 9.6.beta7
2f3f304trac #33579: fix doctests in sagebook

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 5, 2022

Changed commit from 26fe186 to 2f3f304

@dcoudert
Copy link
Contributor Author

dcoudert commented Apr 5, 2022

comment:8

I have corrected the doctests in src/sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py. In parallel I have reported the changes in file graph theory.tex from the sage book (I know have access).

@tscrim
Copy link
Collaborator

tscrim commented Apr 6, 2022

comment:9

Thanks. Then LGTM.

@tscrim
Copy link
Collaborator

tscrim commented Apr 6, 2022

Reviewer: Travis Scrimshaw

@dcoudert
Copy link
Contributor Author

dcoudert commented Apr 6, 2022

comment:10

One issue remains: I'm unable to check the 32 bits doctests. So we might still have an error.

@tscrim
Copy link
Collaborator

tscrim commented Apr 6, 2022

comment:11

Volker, if/when this fails on 32-bit, could you please provide what the results should be? We will then fix it right away.

@kliem
Copy link
Contributor

kliem commented Apr 6, 2022

comment:12

Replying to @dcoudert:

I have corrected the doctests in src/sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py. In parallel I have reported the changes in file graph theory.tex from the sage book (I know have access).

@dcoudert: Could you perhaps apply the same for #32850.

@dcoudert
Copy link
Contributor Author

dcoudert commented Apr 6, 2022

comment:13

I will.

@vbraun
Copy link
Member

vbraun commented Apr 10, 2022

comment:14

I'm getting this on 32-bit:

**********************************************************************
File "src/sage/graphs/generators/random.py", line 99, in sage.graphs.generators.random.RandomGNP
Failed example:
    graphs.RandomGNP(50,.2, algorithm="networkx").size()
Expected:
    260     
Got:
    279
**********************************************************************
1 item had failures:
   1 of  16 in sage.graphs.generators.random.RandomGNP
    [208 tests, 1 failure, 5.27 s]
----------------------------------------------------------------------
sage -t --long --random-seed=0 src/sage/graphs/generators/random.py  # 1 doctest failed
----------------------------------------------------------------------

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 10, 2022

Changed commit from 2f3f304 to 6cbdf91

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 10, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

6cbdf91trac #33579: fix doctest for 32-bit

@dcoudert
Copy link
Contributor Author

comment:16

Thank you Volker for the value. Should be ok now.

@vbraun
Copy link
Member

vbraun commented May 20, 2022

Changed branch from public/graphs/33579_random_seed to 6cbdf91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants