Changes between Initial Version and Version 2 of Ticket #15278


Ignore:
Timestamp:
10/15/13 10:28:54 (8 years ago)
Author:
SimonKing
Comment:

Concerning "weighted": What exactly is the semantics? Is it the case that a weighted graph has positive integral edge weights, that could be taken as the multiplicity of this edge? But then, do we want that a weighted graph is equal to a multigraph with the corresponding multiplicity of edges?

In any case, the hash is currently broken, since it does not take into account weightedness, but equality check does.

It seems to me that the following is the easiest way to go:

  • We keep equality test as it currently is. Here, I am being egoistic: As long as the edge labels and the multiplicity of edges count in equality testing, I simply don't care whether _weighted counts or not. I just need immutable graphs with an unbroken hash.
  • In order to fix the hash, it must take into account precisely the data that are used in __eq__.
  • We want that graphs using the immutable graph backend are immutable in the sense stated above. Hence, we must disallow G.weighted(True/False) if G is supposed to be immutable. Hence, G.weighted should check for the G._immutable flag. Similarly, we must proceed with all other non-underscore methods that could potentially change the ==-class of G.
  • In particular, we want that that G._immutable is set when the immutable backend is in use.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15278 – Description

    initial v2  
    6060So, calling the method `weighted` with an argument changes the `==`-class, even though I guess most mathematicians would agree that `G` has not changed at all. And this would actually be the case even if `G` was using the immutable graph backend!!!
    6161
    62 The aim of this ticket is to sort these things out. To the very least, graphs using the immutable graph backend should not be allowed to change their `==`-class by calling `G.weighted(True)`. This would best be done by banning `._weighted` from the equality test.
     62The aim of this ticket is to sort these things out. To the very least, graphs using the immutable graph backend should not be allowed to change their `==`-class by calling `G.weighted(True)`.