Hello Paulo ! You did, and thank you for that !
The trouble is that the bug does not come from Sage, but rather from the piece of code we call to solve the problem. In sage/graph/modular_decomposition/src/ there is a dm.c file that contains the "smart" code, and contains a line at the top of the file : #define DEBUG 0 I set it to 1, so that the C code can tell us by itself what is actually happening before Sage does anything, and I get as output on your instance (translated from french) : Final Tree: Prime +--3 +--1 +--5 +--2 +--4 Well.. It just means that I have to forward the bug you found to the software's author :-) I just create a trac ticket about that : http://trac.sagemath.org/sage_trac/ticket/13744 Nathann On Wednesday, November 21, 2012 4:07:46 PM UTC+1, Paulo Seijas wrote: > > Hi, > > I think I have found a serious bug on Graph.modular_decomposition. > Clearly, a graph is prime if and only if its complement is so. Nevertheless: > > sage: P = Graph('Dl_') > sage: P.is_prime() > True > sage: P.complement().is_prime() > False > > This behaviour seems to derive from Graph.modular_decomposition. Look: > > sage: P.modular_decomposition() > ('Prime', [2, 0, 4, 1, 3]) > sage: P.complement().modular_decomposition() > ('Prime', [('Serie', [3, 1]), 4, 0, 2]) > > This is not the only example where you can observe this behavior. To > generate easily many examples try, for instance: > > sage: for g in graphs(7): > ....: if g.is_prime() and not g.complement().is_prime(): > ....: g.graph6_string() > ....: > 'Fl_K?' > 'FlGK?' > 'FlSK?' > 'FnsK?' > 'Fl[K?' > 'FheL?' > 'FlUL?' > 'F|UL?' > 'Fl]L?' > 'FlsKG' > 'FlUKG' > 'FluKG' > 'FnV[G' > 'FlT[G' > 'F|tkG' > 'Fl]KG' > 'Fl[KW' > 'Fn|KG' > 'Fn|kG' > 'F|LLG' > 'FnnLG' > 'Flg[?' > 'F|g[?' > 'Fli[?' > 'Flg{?' > 'Fn{[?' > 'Fn}[?' > 'FzN{?' > 'F~H[?' > > Best regards, > Paulo > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To post to this group, send email to sage-support@googlegroups.com. To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support?hl=en.