Ask Your Question

Revision history [back]

Hi,

The GraphQuery command is about consulting the database of small graphs. If you want to actually build the list from scratch use:

sage: from itertools import ifilter
sage: f = lambda g: g.is_connected() and not g.is_long_hole_free()
sage: for g in ifilter(f, graphs(6)):
....:     print g
Graph on 6 vertices
Graph on 6 vertices
....
Graph on 6 vertices

If you want to create the list and not just iterate through them you can use

sage: L = filter(f, graphs(6))
sage: graphs_list.show_graphs(L)

Note that the same method would work with a graph query as well.

Vincent

Hi,

The GraphQuery command is about consulting the database of small graphs. If you want to actually build the list from scratch use:

sage: from itertools import ifilter
sage: f = lambda g: g.is_connected() and not g.is_long_hole_free()
sage: for g in ifilter(f, graphs(6)):
....:     print g
Graph on 6 vertices
Graph on 6 vertices
....
Graph on 6 vertices

If you want to create the list and not just iterate through them you can use

sage: L = filter(f, graphs(6))
sage: graphs_list.show_graphs(L)

Note that the same method would work with a graph query as well.well. But whatever you chose it will take forever with 9 vertices.

Vincent