On 11 December 2014 at 09:19, Nathann Cohen <[email protected]> wrote: >> I think object oriented programming is the right tool to handle such >> issues, and well, Python is object oriented! > > You seem to address a problem different than mine. You want to split the > graph class into something like > > LoopedGraph > SimpleGraph > LoopedMultiGraph > MultiGraph > > That would leave us with no need for a Graph class, but you end your message > by saying that Graph should "the > subclassing job with a nice system of options, defaults and documentation." > > This thread, and my branch, are precisely about how such a subclassing (i.e. > how to auto-detect the graph attributes) should be done when Graph is > called. How would you do that ? My opinion is that Graph(list_of_edges) > should always return a simple graph, unless explicitly mentionned otherwise. > My ticket deprecates the current behaviour to this aim. > > This, to prevent users of graphs with multiple edges to create a simple > graph by mistake, which could lead to wrong results. > >> I suggest that graph theoretists put their methods within SimpleGraph by >> default, and if someone discover that the method remains valid in a more >> general setting (perhaps after some tuning), then promote it to a more >> general class ;) If graph theoretists only work within SimpleGraph class >> (which is legitimate), the other classes will not progress as fast, but at >> least the end-user will not be mislead and pitfalls will be avoided. > > Bear in mind that a user with a LoopedGraph in hand would probably see very > very very few methods available, and as a result may never get to learn what > he could do by casting his graph to a simple one.
Very few methods? Why? All these subclasses can derive from something like "UnderlyingSimpleGraph", where one can put all things that make sense, like connectivity questions, induced subgraphs, etc. Dima -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
