kcrisman wrote: > 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.
I got my information in the previous post from doing sage: graphs? After the (gigantic) list of graphs, it gave the options and documentation for calling graphs(). It wasn't very obvious in the first few pages of documentation that you could call graph directly, though. I think that probably should be documented better. > > 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. Ah, that makes sense. > > 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 Robert will have to answer the efficiency questions. I believe he implemented the most efficient general algorithm known (at least to me), which is the same basic algorithm that is implemented in nauty's geng program. Of course, "efficient" means different things to different people. It takes about 10 seconds to construct the 7-vertex graphs on my P4 3.8GHz with sage. It takes about .004 seconds for nauty to do the same thing. One thing we'll probably look at doing at Sage Days 7 is building an interface to nauty for the speed. We can't distribute nauty with Sage because of licensing issues, but we could maybe make it an optional package with a clear statement about the license (you can't use it for military purposes, for example). Testing for properties, of course, could take a long time, depending on the property. That's one of the big reasons I built that graph database--I was testing for properties that were not very convenient to calculate every time I needed to query on them. So you could also query for graphs that had properties that were precomputed as part of the database. Emily could fill you in with the syntax for the graph querying if you're not already familiar with it. > > sage: L=list(graphs(3)) > sage: M=filter(lambda G: G.size()==3, L) > sage: M > [Graph on 3 vertices] I'll respond to the rest of your email more fully later when I have some time, but would the following be simple enough for new students? It uses the very nice list comprehension functionality in python. sage: [g for g in graphs(3) if g.size()==3] [Graph on 3 vertices] 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 -~----------~----~----~----~------~----~------~--~---