#17086: GenericGraph's documentation, __eq__, and __hash__ out of sync
-------------------------------------+-------------------------------------
Reporter: emassop | Owner:
Type: defect | Status: positive_review
Priority: major | Milestone: sage-6.4
Component: graph theory | Resolution:
Keywords: | Merged in:
Authors: Erik Massop | Reviewers: Nathann Cohen
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/emassop/graph_hash | 5a2a6411c32286a29e18781245c353e3f78e1cff
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by emassop):
At [http://build.sagedev.org/trac/builders/trac_builder/builds/1112],
there are these failures:
{{{
----------------------------------------------------------------------
sage -t src/sage/crypto/mq/sr.py # 5 doctests failed
sage -t src/sage/modular/modform/numerical.py # 2 doctests failed
sage -t src/sage/quivers/path_semigroup.py # 3 doctests failed
sage -t src/sage/rings/polynomial/multi_polynomial_sequence.py # 9
doctests failed
sage -t src/sage/rings/polynomial/pbori.pyx # Killed due to segmentation
fault
sage -t src/sage/rings/polynomial/polynomial_element.pyx # 2 doctests
failed
sage -t src/sage/rings/real_double.pyx # 2 doctests failed
----------------------------------------------------------------------
}}}
Of these
{{{
sage -t src/sage/modular/modform/numerical.py # 2 doctests failed
sage -t src/sage/rings/polynomial/polynomial_element.pyx # 2 doctests
failed
sage -t src/sage/rings/real_double.pyx # 2 doctests failed
}}}
seem to be numerical noise that I can't reproduce. Moreover
{{{
sage -t src/sage/crypto/mq/sr.py # 5 doctests failed
sage -t src/sage/rings/polynomial/multi_polynomial_sequence.py # 9
doctests failed
sage -t src/sage/rings/polynomial/pbori.pyx # Killed due to segmentation
fault
}}}
are pbori segfaults, that I also get after reverting my patches for this
ticket. The remaining failed doctest is
{{{
sage -t src/sage/quivers/path_semigroup.py # 3 doctests failed
}}}
which is indeed caused by my patches here.
Here is the output:
{{{
sage -t src/sage/quivers/path_semigroup.py
**********************************************************************
File "src/sage/quivers/path_semigroup.py", line 179, in
sage.quivers.path_semigroup.PathSemigroup._coerce_map_from_
Failed example:
P1.has_coerce_map_from(P3)
Expected:
False
Got:
True
**********************************************************************
File "src/sage/quivers/path_semigroup.py", line 195, in
sage.quivers.path_semigroup.PathSemigroup._coerce_map_from_
Failed example:
c3 in P1 # indirect doctest
Expected:
False
Got:
True
**********************************************************************
File "src/sage/quivers/path_semigroup.py", line 197, in
sage.quivers.path_semigroup.PathSemigroup._coerce_map_from_
Failed example:
d*c3
Expected:
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for '*':
'Partial semigroup formed by the directed paths of Multi-digraph on 3
vertices'
and 'Partial semigroup formed by the directed paths of Multi-digraph
on 3 vertices'
Got:
d*c
**********************************************************************
1 item had failures:
3 of 18 in sage.quivers.path_semigroup.PathSemigroup._coerce_map_from_
[151 tests, 3 failures, 0.83 s]
}}}
and the failing code:
{{{
def _coerce_map_from_(self, other):
"""
A coercion from `A` to `B` exists if the underlying quiver
of `A` is a sub-quiver of the underlying quiver of `B` (preserving
names).
EXAMPLES::
sage: Q1 = DiGraph({1:{2:['a','b'], 3:['c']}, 3:{1:['d']}})
sage: Q2 = DiGraph({1:{2:['a'], 3:['c']}})
sage: Q3 = DiGraph({1:{2:['a','x'], 3:['c']}, 3:{1:['d']}})
sage: P1 = Q1.path_semigroup()
sage: P2 = Q2.path_semigroup()
sage: P3 = Q3.path_semigroup()
sage: P1.has_coerce_map_from(P2) # indirect doctest
True
sage: P1.has_coerce_map_from(P3)
False
sage: d = P1([(3,1,'d')]); d
d
sage: c = P2([(1,3,'c')]); c
c
sage: c.parent() is P1
False
sage: c in P1 # indirect doctest
True
sage: d*c # indirect doctest
d*c
sage: (d*c).parent() is P1
True
sage: c3 = P3([(1,3,'c')]); c3
c
sage: c3 in P1 # indirect doctest
False
sage: d*c3
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for '*':
'Partial semigroup formed by the directed paths of Multi-
digraph on 3 vertices'
and 'Partial semigroup formed by the directed paths of Multi-
digraph on 3 vertices'
"""
}}}
The problem seems to be that `Q1 == Q3` is true while it should be false
as the labels ought to be checked. This in turn makes `P1 == P3` true.
This didn't register before as the hashes were different, so that the
unique representations P1 and P3 also became different.
Running {{{git grep path_semigroup}}}, I see that the digraphs on which
path_semigroup is called are nowhere 'weighted'. It therefore seems that
the people working on quivers assume that edge labels are checked... This
is now bug #17092.
--
Ticket URL: <http://trac.sagemath.org/ticket/17086#comment:13>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.