-
-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another doctest failure in sage/graphs/graphs.py #10081
Comments
comment:1
According to comment 21ff at #9925, the patches at #9422 and #10067 should fix this problem. If they do, we should close this ticket when they're merged. |
comment:2
Ok, I'm replying here to a good comment Dmitrii made on #10067 and for which I only have bad excuses.
So, first of all, you're right these patches cure only symptoms. The second patch is there to improve the efficiency of is_forest, so it is also there to do something useful, but the other one just fixes the docstring. Why ? From what I know, Ryan developped this sub-class of the Graph class (you are right, it originally inherited the add_edge method from that class) to handle BipartiteGraph that are to stay bipartite. At the moment, if you are working on a Complete Bipartite Graph of size 10,10 then taking its complement, what you will get is an exception, as the complement of such a graph is not bipartite. Because the add_edge method is not inherited anymore from Graph, many, many, many Graph functions can not be expected to work correctly on BipartiteGraph, and for example the subgraph method. I first wanted to fix more than the symptoms by creating ticket #10068, which was meant to modify the bipartite_graph class by listing unreliable methods inherited from Graph and return "NotImplementedError" exceptions when any of them is called. I finally settled against this when I noticed this would have made the class totally useless, and that the best way was to take the time to rewrite those methods inside of bipartite_graph. When I noticed this, I added a comment on that ticket to get it closed, then wrote an email to Ryan Hinton, who is to my knowledge the Sage developper who took care of this class until now. I will break the suspense, I do not intend to do it myself. I can help, as usual, but I do not intend to do such a task by myself when the first thing I do whenever I get an instance of BipartiteGraph is to cast it toward a Graph insance. It is not useful at all for what I do on graphs : the problem is not about bipartite graphs, I like them very much as they tend to signify "You have solved the problem you were working on, because if you have a bipartite graph you can do whatever you want on them as they have the most wonderful properties". The problem is that using this class implicitly assumes that you want your graph to STAY bipartite (and it is a bit worse, as the add_edge method from bipartite graph is not "theoretically" correct). Perhaps the best way to solve the source instead of the symptoms for the moment is to change the natural type of CompleteBipartiteGraph and BipartiteGNP constructors to "Graph", as while they are bipartite graphs, they are not necessarily been built with in mind that they should stay this way. Not that the subgraph method should work on them anyway, this is just something different that has to be addressed to make the bipartitegraph class consistent. It would let us, at least, remove many Graph casts from the docstrings, to prevent what we are dealing with now. Nathann About how the BipartiteGraph class has been built : About a problem I had using the complement method on bipartite graphs: A ticket to fix the add_edge method from bipartite graph (it is not even theoretically correct at the moment, it depends on the current "left" and "right" set) When the add_edge method was modified to suit BipartiteGraph |
comment:5
Replying to @qed777: |
comment:6
Replying to @kcrisman:
I will ask Leonardo whether he can review #9422... Any of these two tickets is enough to fix the bug, and they are 3 lines long so it should not be too time-consuming Nathann |
Karl-Dieter Crisman reported this error on sage-release:
This is a followup to #9925.
Release Manager
Apply the patch at #9422.
CC: @dimpase @kcrisman @nathanncohen @rhinton @jasongrout
Component: doctest coverage
Issue created by migration from https://trac.sagemath.org/ticket/10081
The text was updated successfully, but these errors were encountered: