sagemath/sage

Fig bug in graphs.RandomToleranceGraph

Closed this issue · 8 comments

Part of #32544:

sage -t --long --warn-long 291.5 --random-seed=184268751501867371650794470659094787547 src/sage/graphs/generators/random.py
**********************************************************************
File "src/sage/graphs/generators/random.py", line 1527, in sage.graphs.generators.random.RandomToleranceGraph
Failed example:
    g = graphs.RandomToleranceGraph(8)
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/doctest/forker.py", line 695, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/doctest/forker.py", line 1093, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generators.random.RandomToleranceGraph[0]>", line 1, in <module>
        g = graphs.RandomToleranceGraph(Integer(8))
      File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/graphs/generators/random.py", line 1553, in RandomToleranceGraph
        return ToleranceGraph(tolrep)
      File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/graphs/generators/intersection.py", line 351, in ToleranceGraph
        raise ValueError("Invalid tolerance representation at position "+str(i)+"; third value must be positive!")
    ValueError: Invalid tolerance representation at position 2; third value must be positive!

Method graphs.ToleranceGraph raises an error when a tolerance is <= 0.

CC: @tscrim

Component: graph theory

Author: David Coudert

Branch/Commit: b4c34bb

Reviewer: Travis Scrimshaw

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

Commit: b4c34bb

New commits:

b4c34bbtrac #33628: fix bug in random tolerance graph generator

Description changed:

--- 
+++ 
@@ -1,3 +1,4 @@
+Part of #32544:
 
 ```
 sage -t --long --warn-long 291.5 --random-seed=184268751501867371650794470659094787547 src/sage/graphs/generators/random.py
@@ -19,3 +20,4 @@
         raise ValueError("Invalid tolerance representation at position "+str(i)+"; third value must be positive!")
     ValueError: Invalid tolerance representation at position 2; third value must be positive!
 ```
+Method `graphs.ToleranceGraph` raises an error when a tolerance is `<= 0`.

Reviewer: Travis Scrimshaw

comment:3

LGTM.

comment:4

Thank you !

Changed branch from public/graphs/33628_random to b4c34bb