OK, looking into this a bit more it's definitely a PEBCAK error - I 
misremembered the definition of connected graph.  I was confused because 
G.is_connected() was returning True (it seems like is_connected should 
really only be used for undirected graphs).  I guess I can implement the 
method I really want by using something along the lines of max(filter(lambda 
x: x != Infinity, G.eccentricity())).

Thanks!

On Sunday, January 11, 2015 at 5:02:10 PM UTC-7, David Joyner wrote:
>
> On Sun, Jan 11, 2015 at 5:49 PM, Andrew Russell 
> <[email protected] <javascript:>> wrote: 
> > I'm running Sage 6.4.1 on OS X (Yosemite).  Creating a finite, connected 
> DAG 
> > with n vertices (for any n that I tried) returned +Infinity.  EG: 
> > 
> > sage: digraphs.Path(10).diameter() 
> > +Infinity 
> > 
> > or even 
> > 
> > sage: digraphs.ButterflyGraph(5).diameter() 
> > +Infinity 
> > 
> > However, both of these Path and Butterfly graphs are finite, connected, 
> > directed acyclic graphs so their diameter should always be finite.  I 
> need 
> > to be able to compute the largest diameter of the connected components 
> of 
> > any finite DAG, yet the diameter method fails even on these simple 
> cases. 
> > 
>
> Seems to me to work as documented (using Gamma.diameter? or 
> Gamma.diameter??): 
>
> sage: Gamma = digraphs.Path(3) 
> sage: Gamma.diameter() 
> +Infinity 
> sage: Gamma.eccentricity(0) 
> 2 
> sage: Gamma.eccentricity(1) 
> +Infinity 
> sage: Gamma = digraphs.Circuit(3) 
> sage: Gamma.diameter() 
> 2 
> sage: Gamma.eccentricity(0) 
> 2 
> sage: Gamma.eccentricity(1) 
> 2 
> sage: Gamma.eccentricity(2) 
> 2 
>
>
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sage-support" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at http://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to