#12148: random_digraph fails with ZeroDivisionError
----------------------------+-----------------------------------------------
   Reporter:  vbraun        |          Owner:  jason, ncohen, rlm
       Type:  defect        |         Status:  new               
   Priority:  major         |      Milestone:  sage-4.8          
  Component:  graph theory  |       Keywords:                    
Work_issues:                |       Upstream:  N/A               
   Reviewer:                |         Author:                    
     Merged:                |   Dependencies:                    
----------------------------+-----------------------------------------------
 With default arguments the `random_digraph` method fails with a zero
 division:
 {{{
 sage: random_digraph(3)
 ---------------------------------------------------------------------------
 ZeroDivisionError                         Traceback (most recent call
 last)

 /home/vbraun/<ipython console> in <module>()

 /home/vbraun/opt/sage-4.8.alpha3/local/lib/python2.6/site-
 packages/sage/sandpiles/sandpile.pyc in random_digraph(num_verts, p,
 directed, weight_max)
    4861
    4862     a = digraphs.RandomDirectedGN(num_verts)
 -> 4863     b = graphs.RandomGNP(num_verts,p)
    4864     a.add_edges(b.edges())
    4865     if directed:

 /home/vbraun/opt/sage-4.8.alpha3/local/lib/python2.6/site-
 packages/sage/graphs/graph_generators.pyc in RandomGNP(self, n, p, seed,
 fast)
    5078         import networkx
    5079         if fast:
 -> 5080             G = networkx.fast_gnp_random_graph(n, p, seed=seed)
    5081         else:
    5082             G = networkx.gnp_random_graph(n, p, seed=seed)

 
/home/vbraun/opt/sage-4.8.alpha3/local/lib/python/networkx/generators/random_graphs.pyc
 in fast_gnp_random_graph(n, p, create_using, seed)
     131     while v<n:
     132         lr=math.log(1.0-random.random())
 --> 133         w=w+1+int(lr/lp)
     134         while w>=v and v<n:
     135             w=w-v

 ZeroDivisionError: float division
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12148>
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