Hi Jason - good to hear from you.

Hmm, now I'm really stumped.  Unfortunately, the online documentation
is all messed up - nodes misplaced and everything - and it's only deep
within the bowels of graph_generators.py that this information is
found.  I think this is new since my installation.

However, the output is correct (except 0), because the 2.8.12 version
of graphs(3) gives all graphs of order less than or equal to 3.

Okay, then I have a different question.  Is it possible or even
somewhat efficient to first generate all graphs of n vertices (for n
small, whatever that means) and then test them for a property such as
size == m?  E.g. something like

sage: L=list(graphs(3))
sage: M=filter(lambda G: G.size()==3, L)
sage: M
[Graph on 3 vertices]

Any thoughts?  I've been impressed by the functionality Robert, Emily,
and you have been able to get into this package.  There's even now be
a trees() method to graphs, which is great!  By the way, Networkx
reports that https://networkx.lanl.gov/ticket/132 has been closed and
fixed - I don't know if that is accurate or not, but if it is that is
nice for your is_bipartite method.

Still, notwithstanding the fact that by careful reading of a *lot* of
Python documentation and trying to keep up with the Sage source code I
was able to concoct the example above, actually using the
functionality is pretty awkward.  If Robert Miller is reading this,
this is the heart of what I didn't do a very good job of explaining at
the Joint Math Meetings: I could not, in good conscience, ask a given
student (outside of an independent study) to try to do this, or even
to modify it appropriately for their own explorations.  What I would
really like is for students to be able to do exploration of all the
great properties of graphs which are accessible via graphs.[tab], but
with the simplest syntax possible, and without having to struggle
through these same things I am.

Even the syntax of the graphs_list.show_graphs(list) is pretty thorny
and certainly nonintuitive compared to the rest of Sage graphics,
though I assume there is a good reason for this, and it never changes,
so it's usable in the classroom.  Having to use lambda constructions
(which are very hard to understand coming from the math side of
things) to do what I am trying to do is too much.  Then I would rather
use the time with them doing their own by-hand constructions, which
one would start with anyway.

What I envision instead (here is the feature request) is something
like list(graphs(3,size==3)), even though I know that is probably not
possible. (I wouldn't push it and ask for size=3 !)  Even having an
alias for the <= n vertices and =n vertices versions of the generators
which are intuitive could be helpful.  Accessing the database isn't
really a solution either from that standpoint, and obviously not an
option for graphs of order > 8, but maybe it's just not realistic
using any other standpoint either, given the numbers of objects
involved.  On the non-complaining side, if it does work out to use in
class, hopefully we'll contribute a few extra methods by the end of
the term.

Thanks for any feedback.  We are working to get a Sage distribution
hosted on our departmental server for this semester, which will be
great for several other courses as well.

-kcrisman

On Jan 18, 4:17 pm, Jason Grout <[EMAIL PROTECTED]> wrote:
> kcrisman wrote:
> > Using Sage 2.8.12 (attempted on the notebook servers with current
> > version, but the one my account is one is sagenb.org and never gave an
> > output at all), the following behavior happens:
>
> > sage: L = list(graphs(3, lambda H: H.size() <=3))
> > sage: len(L)
> > 8
>
> > Yet,
>
> > sage: L = list(graphs(3, lambda H: H.size() ==3))
> > sage: len(L)
> > 0
>
> > even though
>
> > sage: for G in L: print G.size()
> > 0
> > 0
> > 0
> > 0
> > 1
> > 2
> > 1
> > 3
>
> > But, interestingly,
>
> > sage: L = list(graphs(3, lambda H: H.size() !=3))
> > sage: len(L)
> > 7
>
> > I assume this is a bug, but because I don't understand
> > canaug_traverse, I am not certain. Thanks for any clarification!
> > Apologies in advance if this was already fixed and I didn't get it due
> > to lackadaisical upgrades.
>
> Under Sage 2.9.3:
> sage: L = list(graphs(3, lambda H: H.size() <=3))
> sage: len(L)
> 4
> sage: L = list(graphs(3, lambda H: H.size() ==3))
> sage: len(L)
> 0
> sage: for G in L: print G.size()
> ....:
> sage: L = list(graphs(3, lambda H: H.size() !=3))
> sage: len(L)
> 3
>
> This seems to match the documentation, which says that with the default
> options, if the test function has the property that if a graph passes
> the test, then every subgraph obtained by deleting edges also passes the
> test, then you will get a complete listing of all graphs which satisfy
> the test function.
>
> Thus the results in Sage 2.9.3 correctly indicate that there are 4
> graphs with size <=3.  Because the maximum number of edges is 3 on
> 3-vertex graphs, the last example also correctly calculates that there
> are 3 graphs with size < 3.  However, the generating method does not
> guarantee that the second example (size==3) will produce all graphs with
> exactly 3 edges.
>
> It is interesting that you get different numbers (8, 0, and 7 compared
> to 4, 0, and 3).
>
> Jason
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to