#5003: [with patch, needs work] equality testing in graphs should check
"weighted"
property
--------------------------+-------------------------------------------------
Reporter: rlm | Owner: rlm
Type: defect | Status: new
Priority: major | Milestone: sage-3.3
Component: graph theory | Resolution:
Keywords: |
--------------------------+-------------------------------------------------
Changes (by shumow):
* summary: [with patch, needs review] equality testing in graphs should
check "weighted" property => [with patch, needs
work] equality testing in graphs should check
"weighted" property
Comment:
Hey, I ran into some doctest failures w/ your new change.
Specifically, around line 839 (in the docstring for
weighted_ajacency_matrix(...)):
{{{
EXAMPLES:
sage: G = Graph(sparse=True)
sage: G.add_edges([(0,1,1),(1,2,2),(0,2,3),(0,3,4)])
sage: M = G.weighted_adjacency_matrix(); M
[0 1 3 4]
[1 0 2 0]
[3 2 0 0]
[4 0 0 0]
sage: H = Graph(data=M, format='weighted_adjacency_matrix',
sparse=True)
sage: H == G
True
}}}
This fails. Specifically, G.weighted() returns false (which seems like
its own bug.)
And Also, the example starting at line 1180 (in the docstring for
weighted(...):
{{{
EXAMPLE:
Here we have two graphs with different labels, but weighted is
False
for both, so we just check for the presence of edges:
sage: G = Graph({0:{1:'a'}}, implementation='networkx')
sage: H = Graph({0:{1:'b'}}, implementation='networkx')
sage: G == H
True
Now one is weighted and the other is not, so the comparison is
done as
if neither is weighted:
sage: G.weighted(True)
sage: H.weighted()
False
sage: G == H
True
}}}
Fails. Because of the change.
The first of these issues, is a bug and should be fixed IMHO. The second
issue is more subtle and disturbing. Particularly because it indicates
that a valid example used to work, you will be breaking compatibility with
code that works this way, and you should think about what the previous
assumptions were, and if you can work around them with a fix.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5003#comment:1>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---