#15278: Hash and equality for graphs
-------------------------------------+-------------------------------------
Reporter: SimonKing | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-5.13
Component: graph theory | Resolution:
Keywords: | Merged in:
Authors: Simon King | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/SimonKing/ticket/15278 | 07bad466ab9a3e2ffe82c142cc6d0c515f1ae452
Dependencies: #12601, #15491 | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by SimonKing):
I think we need to take care of another detail:
If the static graph backend is used, then `self.delete_vertex(vertex)` and
similar mutating methods will result in an error raised by the backend.
However, the problem is that the backend is only called in the very end,
after doing damage to attributes that the graph takes care of in addition
to the backend:
{{{
#!python
if in_order:
vertex = self.vertices()[vertex]
if vertex not in self:
raise RuntimeError("Vertex (%s) not in the
graph."%str(vertex))
attributes_to_update = ('_pos', '_assoc', '_embedding')
for attr in attributes_to_update:
if hasattr(self, attr) and getattr(self, attr) is not None:
getattr(self, attr).pop(vertex, None)
self._boundary = [v for v in self._boundary if v != vertex]
self._backend.del_vertex(vertex)
}}}
Shouldn't this better be
{{{
if in_order:
vertex = self.vertices()[vertex]
if vertex not in self:
raise RuntimeError("Vertex (%s) not in the
graph."%str(vertex))
self._backend.del_vertex(vertex)
attributes_to_update = ('_pos', '_assoc', '_embedding')
for attr in attributes_to_update:
if hasattr(self, attr) and getattr(self, attr) is not None:
getattr(self, attr).pop(vertex, None)
self._boundary = [v for v in self._boundary if v != vertex]
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/15278#comment:24>
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/groups/opt_out.