#10432: is_directed_acyclic is Cython (--> without NetworX) and its certificates
-----------------------------+----------------------------------------------
   Reporter:  ncohen         |       Owner:  jason, ncohen, rlm
       Type:  enhancement    |      Status:  needs_work        
   Priority:  major          |   Milestone:  sage-4.6.1        
  Component:  graph theory   |    Keywords:                    
     Author:  Nathann Cohen  |    Upstream:  N/A               
   Reviewer:                 |      Merged:                    
Work_issues:                 |  
-----------------------------+----------------------------------------------
Changes (by ncohen):

  * status:  new => needs_work


Old description:

> This patch contains an Cython implementation of a method testing whether
> a given digraph is acyclic. If it is, the method returns a topological
> sort, and returns a circuit otherwise. The method is then called through
> current Sage methods which relied on NetworkX
>
> Nathann

New description:

 This patch contains an Cython implementation of a method testing whether a
 given digraph is acyclic. If it is, the method returns a topological sort,
 and returns a circuit otherwise. The method is then called through current
 Sage methods which relied on NetworkX

 {{{
 #!python
 def random_acyclic(n, p):
 ...    g = graphs.RandomGNP(n, p)
 ...    h = DiGraph()
 ...    h.add_edges([ ((u,v) if u<v else (v,u)) for u,v,_ in g.edges() ])
 ...    return h
 }}}

 Before :

 {{{
 #!python
 sage: g = random_acyclic(100, .2)
 sage: %timeit g.is_directed_acyclic()
 125 loops, best of 3: 6.54 ms per loop
 sage: g = random_acyclic(100, .2)
 sage: %timeit g.is_directed_acyclic()
 125 loops, best of 3: 6.79 ms per loop
 sage: g = random_acyclic(100, .2)
 sage: %timeit g.is_directed_acyclic()
 125 loops, best of 3: 6.72 ms per loop
 sage: g = random_acyclic(100, .2)
 sage: %timeit g.is_directed_acyclic()
 125 loops, best of 3: 6.96 ms per loop
 }}}

 After :

 {{{
 #!python
 g = random_acyclic(100, .2)
 %timeit g.is_directed_acyclic()
 }}}

 Nathann

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10432#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to