Skip to content

Commit

Permalink
Trac #26994: graph canonical labels and doctest failures in databases…
Browse files Browse the repository at this point in the history
…/sql_db.py

Starting from somewhere around 8.5.beta the canonical labels given by
Sage and bliss are different on some instances
{{{
sage: G1 = Graph("Cr")
sage: G2 = Graph("C]")
sage: G1 == G2
False
sage: G1.is_isomorphic(G2) and G2.is_isomorphic(G1)
True
sage: G1.canonical_label(algorithm='bliss') == G1
True
sage: G1.canonical_label(algorithm='sage') == G2
True
}}}
That is `Cr` is canonical for bliss while `C]` is canonical for Sage...
More examples:
- 4 vertices: {{{C`}}} vs {{{CK}}}, {{{CR}}} vs {{{CL}}} and {{{Cr}}} vs
{{{C]}}}
- 5 vertices: {{{DGC}}} vs {{{D@O}}}, {{{DAK}}} vs {{{D@S}}}, {{{DC[}}}
vs {{{D@s}}}, {{{DIK}}} vs {{{DBW}}}, {{{DD[}}} vs {{{DBk}}}, {{{DDW}}}
vs {{{DBg}}}, {{{D`{}}} vs {{{DK{}}}, {{{DqK}}} vs {{{DLo}}}, {{{DMk}}}
vs {{{Dbk}}}, {{{DR{}}} vs {{{DL{}}}, {{{DR[}}} vs {{{DJk}}}, {{{Dr{}}}
vs {{{D]{}}}

As a consequence, when bliss is installed, we have the two following
doctest failures in `databases/sql_db.py`.
{{{
sage -t --long src/sage/databases/sql_db.py
**********************************************************************
File "src/sage/databases/sql_db.py", line 956, in
sage.databases.sql_db.SQLDatabase.__init__
Failed example:
    D.show('simon')
Expected:
    graph6               vertices             edges
    ------------------------------------------------------------
    ?                    0                    0
    @                    1                    0
    A?                   2                    0
    A_                   2                    1
    B?                   3                    0
    BG                   3                    1
    BW                   3                    2
    Bw                   3                    3
    C?                   4                    0
    C@                   4                    1
    CB                   4                    2
    CF                   4                    3
    CJ                   4                    3
    CK                   4                    2
    CL                   4                    3
    CN                   4                    4
    C]                   4                    4
    C^                   4                    5
    C~                   4                    6
Got:
    graph6               vertices             edges
    ------------------------------------------------------------
    ?                    0                    0
    @                    1                    0
    A?                   2                    0
    A_                   2                    1
    B?                   3                    0
    BG                   3                    1
    BW                   3                    2
    Bw                   3                    3
    C?                   4                    0
    C@                   4                    1
    CB                   4                    2
    CF                   4                    3
    CJ                   4                    3
    C`                   4                    2
    CR                   4                    3
    CN                   4                    4
    Cr                   4                    4
    C^                   4                    5
    C~                   4                    6
**********************************************************************
File "src/sage/databases/sql_db.py", line 1004, in
sage.databases.sql_db.SQLDatabase.__init__
Failed example:
    E.show('simon')
Expected:
    graph6               vertices             edges
    ------------------------------------------------------------
    ?                    0                    0
    @                    1                    0
    A?                   2                    0
    A_                   2                    1
    B?                   3                    0
    BG                   3                    1
    BW                   3                    2
    Bw                   3                    3
    C?                   4                    0
    C@                   4                    1
    CB                   4                    2
    CF                   4                    3
    CJ                   4                    3
    CK                   4                    2
    CL                   4                    3
    CN                   4                    4
    C]                   4                    4
    C^                   4                    5
    C~                   4                    6
Got:
    graph6               vertices             edges
    ------------------------------------------------------------
    ?                    0                    0
    @                    1                    0
    A?                   2                    0
    A_                   2                    1
    B?                   3                    0
    BG                   3                    1
    BW                   3                    2
    Bw                   3                    3
    C?                   4                    0
    C@                   4                    1
    CB                   4                    2
    CF                   4                    3
    CJ                   4                    3
    C`                   4                    2
    CR                   4                    3
    CN                   4                    4
    Cr                   4                    4
    C^                   4                    5
    C~                   4                    6
**********************************************************************
1 item had failures:
   2 of  26 in sage.databases.sql_db.SQLDatabase.__init__
    [288 tests, 2 failures, 1.59 s]
}}}

URL: https://trac.sagemath.org/26994
Reported by: vdelecroix
Ticket author(s): David Coudert
Reviewer(s): Volker Braun
  • Loading branch information
Release Manager authored and vbraun committed Jan 2, 2019
2 parents 7eb4db2 + a1a96fa commit bc5178a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sage/databases/sql_db.py
Expand Up @@ -949,7 +949,7 @@ def __init__(self, filename=None, read_only=None, skeleton=None):
sage: for i in range(2, 5):
....: labels[i] = []
....: for g in all_labeled_graphs(i):
....: g = g.canonical_label()
....: g = g.canonical_label(algorithm='sage')
....: if g not in labels[i]:
....: labels[i].append(g)
....: D.add_row('simon', (g.graph6_string(), g.order(), g.size()))
Expand Down

0 comments on commit bc5178a

Please sign in to comment.