Hello Nathann,

You're absolutely right! The problem is due to 
sage/graph/modular_decomposition/src/dm.c. I've managed to compile it in C, 
coded the graph P and got:

 Premier 
  +--3
  +--1
  +--5
  +--2
  +--4

So, I downloaded the most current version of the source code from 
http://www.liafa.jussieu.fr/~fm/algos/dm.tar, compiled it and run the exact 
same code codifying the graph P. This time I got the right answer:

 Premier 
  +--2
  +--0
  +--4
  +-Parallele 
  |  +--1
  |  +--3

So, the bug seem to be fixed in the most current version from Fabien's 
webpage.

Introducing some changes into the file dm.c by hand seem to be not enough 
to make sage recompile it and change the behaviour of the command 
"P.modular_decomposition()" afterwards. Could you please tell how could I 
sage know that it must recompile dm.c after I modify it?

Best,
Paulo

On Thursday, November 22, 2012 12:04:56 PM UTC-3, Nathann Cohen wrote:
>
> 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.


Reply via email to