#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           |  c774057bf07b2da8539f2395555b2062428874f4
   Dependencies:  #12601             |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by SimonKing):

 Back at questions on the static graph backend...

 In `__eq__`, the following data play a role:
 - `.allows_multiple_edges()`
 - `.allows_loops()`
 - `.order()`
 - `.size()`
 - `._weighted`
 - vertex and edge labels, and of course start and endpoints of the edges.

 For immutability, it is thus essential that these methods do not change
 the answers after applying non-underscore methods.
 - `._weighted` may be changed by the `.weighted(new)` method, which I thus
 made respectful against mutability. So, that is settled.
 - The methods mentioned above call the backend, namely:
   1. `._backend.multiple_edges(None)
   2. `._backend.loops(None)`
   3. `._backend.num_verts()`
   4. `._backend.num_edges(self._directed)`

 So, my question boils down to this, Nathann: Is it possible for the static
 backend that the return value of the above methods 1.--4. changes, if the
 user is only using non-underscore methods on the graph? If it is not
 possible, then the `__eq__` classes won't change when using the static
 graph backend, and I am happy.

 The hash only takes into account the tuple of vertices and edges (which
 includes their labels). You have already confirmed that this is fine with
 the static backend.

--
Ticket URL: <http://trac.sagemath.org/ticket/15278#comment:14>
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.

Reply via email to