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

Error in function Graph.odd_girth() #17640

Closed
sagetrac-ffoucaud mannequin opened this issue Jan 16, 2015 · 11 comments
Closed

Error in function Graph.odd_girth() #17640

sagetrac-ffoucaud mannequin opened this issue Jan 16, 2015 · 11 comments

Comments

@sagetrac-ffoucaud
Copy link
Mannequin

sagetrac-ffoucaud mannequin commented Jan 16, 2015

Hi,
I'm doing some computations based on enumerating graphs via "nauty_geng()", which enumerate all graphs of a given order.

For each graph, among other few things, I test the odd girth of the generated graphs (see code below). The code runs fine for some hours (i.e. it is able to perform the odd_girth() test for many millions graphs), but after some time it fails, with an error message indicating there is a problem in Graph.odd_girth(). The error messages indicate a possible relation with matrices and/or primes (see below).

Unfortunately since the code runs fine for some hours and only fails after a long time, I cannot reproduce the bug without doing the whole computation.

Note: I realise that I am using the precompiled version 5.8 of sage that comes with the ubuntu repository (ubuntu 12.04). So maybe this is fixed in newer versions... In any case I will now use the latest release.
EDIT: the same bug happens with Sage 6.4 (run on another computer).

Here is my code:

def OG7_NOhomC5(begin,end):
    F=[]
    C5=graphs.CycleGraph(5)
    for n in [begin .. end]: #range for orders
        for g in graphs.nauty_geng("%s -c -t -d2 -D6"%n):
            if g.girth()==4 and g.odd_girth()>=7:
                maps=g.has_homomorphism_to(C5)
                if maps == False:
                    F += [(g.graph6_string())]
                    print ' found :-)',F

And I called:

OG7_NOhomC5(13,13)
OG7_NOhomC5(14,14)
OG7_NOhomC5(15,15)

in three different worksheets of the notebook interface.

And here are 2 different tracebacks that stopped the computation of "OG7_NOhomC5(13,13)" and "OG7_NOhomC5(14,14)", both have an error located in "odd_girth()". Note that "OG7_NOhomC5(15,15)" has not stopped, and is still running after about 8 hours.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_3.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("T0c3X05PaG9tQzUoMTQsMTQp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpPMZ4j_/___code___.py", line 3, in <module>
    exec compile(u'OG7_NOhomC5(_sage_const_14 ,_sage_const_14 )
  File "", line 1, in <module>
    
  File "/tmp/tmp1XHck_/___code___.py", line 10, in OG7_NOhomC5
    if g.girth()==_sage_const_4  and g.odd_girth()>=_sage_const_7 :
  File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 2388, in odd_girth
    ch = ((self.am()).charpoly()).coeffs()
  File "matrix_integer_dense.pyx", line 1042, in sage.matrix.matrix_integer_dense.Matrix_integer_dense.charpoly (sage/matrix/matrix_integer_dense.c:11571)
  File "matrix_integer_dense.pyx", line 1099, in sage.matrix.matrix_integer_dense.Matrix_integer_dense._charpoly_linbox (sage/matrix/matrix_integer_dense.c:12253)
  File "matrix_integer_dense.pyx", line 1121, in sage.matrix.matrix_integer_dense.Matrix_integer_dense._poly_linbox (sage/matrix/matrix_integer_dense.c:12534)
RuntimeError: Segmentation fault
you are running out of primes. 1000 coprime primes foundTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_4.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("T0c3X05PaG9tQzUoMTMsMTMp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpRfy2qw/___code___.py", line 3, in <module>
    exec compile(u'OG7_NOhomC5(_sage_const_13 ,_sage_const_13 )
  File "", line 1, in <module>
    
  File "/tmp/tmp1inrim/___code___.py", line 10, in OG7_NOhomC5
    if g.girth()==_sage_const_4  and g.odd_girth()>=_sage_const_7 :
  File "/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 2392, in odd_girth
    if ch[i] != 0:
IndexError: list index out of range

Component: graph theory

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

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Jan 16, 2015

comment:1

Could you provide an instruction that triggers that bug ? We cannot do much with a function when we do not know how it should be called. Also, you cannot ask us to 'run computations for hours' in order to check it. Thanks for your understanding,

Nathann

@nathanncohen nathanncohen mannequin added the s: needs info label Jan 16, 2015
@sagetrac-ffoucaud

This comment has been minimized.

@sagetrac-ffoucaud
Copy link
Mannequin Author

sagetrac-ffoucaud mannequin commented Jan 16, 2015

comment:3

Replying to @nathanncohen:

Could you provide an instruction that triggers that bug ? We cannot do much with a function when we do not know how it should be called. Also, you cannot ask us to 'run computations for hours' in order to check it. Thanks for your understanding,

I clarified my text, is it more clear now?

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Jan 16, 2015

comment:4

Yes, thanks. Could you give us the graphs g that your code found such that g.odd_girth produces a bug ?

Nathann

@sagetrac-ffoucaud

This comment has been minimized.

@sagetrac-ffoucaud
Copy link
Mannequin Author

sagetrac-ffoucaud mannequin commented Jan 16, 2015

comment:5

Replying to @nathanncohen:

Yes, thanks. Could you give us the graphs g that your code found such that g.odd_girth produces a bug ?

OK, so here is one graph of order 15 for which there was an error:
:NqA?PRGSqgbG\AWbIWyGaESp~

And another one of order 14 (for this one, I got the "running out of prime" error):
:MoAG`oAQ@RFR?PAecKhbg

Edit: a third one, of order 13 this time: :Lm?K@RHGhbrGS{PdKb

For all of them, calling odd_girth() is not a problem. Note that they all have odd girth 5. Maybe this is a problem with the amount of calls to "odd_girth()" that are done?

@sagetrac-ffoucaud

This comment has been minimized.

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Jan 16, 2015

comment:7

This seems related to #15535 and #12883

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Jan 16, 2015

comment:8

Yeah it sees related to the number of calls, as other persons seem to have met the same problem when computing many characteristic polynomials :-/

Nathann

@sagetrac-ffoucaud
Copy link
Mannequin Author

sagetrac-ffoucaud mannequin commented Jan 16, 2015

comment:9

OK, thanks... At least it seems to be a known bug.

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Jan 18, 2015

comment:10

This ticket corresponds to the bug reported at #15535. Should be closed as a 'duplicate'.

Nathann

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

1 participant