sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.39k stars 473 forks source link

is_directed_acyclic(certificate=True) doesn't always give an ordering back #12180

Open koffie opened 12 years ago

koffie commented 12 years ago

Currently we have:

sage: m=Matrix(3,[0, 1, 1, 0, 0, 0, 0, 1, 0])
sage: g=DiGraph(m)
sage: g.is_directed_acyclic(certificate=True)
(True, [0, 1, 2, 1])

Component: combinatorics

Keywords: sd35

Work Issues: rebase to 11950

Author: Maarten Derickx, David Harvey

Issue created by migration from https://trac.sagemath.org/ticket/12180

koffie commented 12 years ago

Description changed:

--- 
+++ 
@@ -3,6 +3,6 @@

sage: m=Matrix(3,[0, 1, 1, 0, 0, 0, 0, 1, 0]) sage: g=DiGraph(m) -sage: g.is_directed_acyclic(certificate=True)[1] -[0, 1, 2, 1] +sage: g.is_directed_acyclic(certificate=True) +(True, [0, 1, 2, 1])

koffie commented 12 years ago

Changed keywords from none to sd35

koffie commented 12 years ago
comment:3

Attachment: 12180-fix_is_directed_acyclic.patch.gz

It is working now. There is also a more extensive randomized test because the old test didn't find the bug because the dags it generated where already ordered, and ordering something already ordened is significantly easier. Also the randomized testing did not test non dags. Ps. David harvey wrote most of the test code.

koffie commented 12 years ago

Author: Maarten Derickx, David Harvey

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 12 years ago
comment:5

Helloooooooo !!!

I think I fixed it already :-)

It must beeeee....... #11950 !

Currently, in Sage 5.0-beta2 :

sage: m=Matrix(3,[0, 1, 1, 0, 0, 0, 0, 1, 0])
sage: g=DiGraph(m)
sage: g.is_directed_acyclic(certificate=True)
(True, [0, 2, 1])

Nathann

koffie commented 12 years ago
comment:6

Ok, I didn't find that one when creating this ticket, because it didn't mention the is_directed_acyclic anywhere. I'm putting this to needs work again because I think at least some parts of the patch here are superior with respect 11950. The two things being the addition of a more rigid randomized doctest and the removal of inserting stuff at the beginning of the list (see line 2806 after applying 11950, or line 2796 before applying it). This stupid inserting at the front of a list basically changes an algorithm whose run time is linear in the number of vertices to something wich is quadratic in the number of vertices!

koffie commented 12 years ago

Work Issues: rebase to 11950

rwst commented 10 years ago
comment:7

Better revert milestone then too.

vbraun commented 10 years ago
comment:9

Reviewer name, work issues?

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 10 years ago
comment:10

No idea... I just saw a ticket in wontfix, so I changed it to positive_review O_o

Nathann

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 10 years ago
comment:11

Arg, I am an idiot. It was changed FROM wontfix to 6.3 T_T

dcoudert commented 2 years ago
comment:14

Note that since #30479 we have digraphs.RandomDirectedAcyclicGraph. It might be helpful if you plan to add tests to is_directed_acyclic.

Also, I think this ticket should be in graph theory and not combinatorics.