So you are saying that only the generic Graph should be mutable, thats fine. Just make all derived FooGraph's immutable. The base Graph class can have as_foo_graph() methods that check the property and return a suitable specialized class.
On Monday, June 18, 2012 12:15:00 PM UTC+1, Nathann Cohen wrote: > > > Usually the "huge source file" problem is just a symptom of trying to > > stuff everything into one class. You should probably think about whether > you > > can introduce a class hierarchy somewhere, especially if your > is_something() > > property doesn't make sense for the most generic graph. Maybe you want to > > put your code into a PerfectGraph subclass, for example. > > Well, the trouble is that you never know in advance which properties your > graph will have. And that even if you did, very useful operations like > add/remove edge would not be available, because you can not add edges to a > perfect graph and hope that it will stay perfect forever. Things got very > scary when someone thought that the BipartiteGraph class should overrule > the .complement() function so that the graphs stay bipartite :-P > > I honestly thought for a while about ways to reduce the size of these > classes, and found no clean way out. > > But being able to get these aliases to work with Cython module would > reaaaaaaaaaaallly make a difference, at least with the source files :-) > > 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