> Maybe the problem is that somewhere in the depths of is_perfect, a > BipartiteGraph is being created without the intention to use it that > way. Perhaps it is in self.complement(), or some other function that > is implicitly assuming to use the current class to make a copy, when > it should be making a copy as a different class. Maybe we just need to > assume less when creating derived objects...
Nonon, it is just that if you now type g.complement() on a Bipartite Graph in Sage, you will raise an exception ! My function fails only when I call it on a bipartite Graph ! sage: g = graphs.CompleteBipartiteGraph(10,10) sage: g.complement() --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) /home/ncohen/<ipython console> in <module>() /home/ncohen/.Sage/local/lib/python2.6/site-packages/sage/graphs/generic_graph.py in complement(self) 8497 for v in self: 8498 if not self.has_edge(u,v): -> 8499 G.add_edge(u,v) 8500 return G 8501 /home/ncohen/.Sage/local/lib/python2.6/site-packages/sage/graphs/bipartite_graph.py in add_edge(self, u, v, label) 690 # check for endpoints in different partitions 691 if self.left.issuperset((u,v)) or self.right.issuperset((u,v)): --> 692 raise RuntimeError('Edge vertices must lie in different partitions.') 693 694 # add the edge RuntimeError: Edge vertices must lie in different partitions. sage: Obviously, we can not expect the function .complement() in BipartiteGraph to return a BipartiteGraph (well, I know, if you graph is the disjoint union of two edges, or a P_4, or ... ). I never intended my message as a bug report, of course something needs to be fixed there but the question is rather : what is to be done of this BipartiteGraph class, and should it be a default one that users could instantiate without knowing it ? I know where the bug comes from, but I begin to know Sage's code for graphs, and I reviewed myself the ticket about edge addition, but there is no way for a normal user to think of it as something else than a bug in Sage, or a very bad idea of class design... :-/ Nathann -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org