Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Create program to find which graphs contain specific subgraph

Hello, I am pretty new to Sage, and am discovering all the wonderful things it can do. I know how to ask Sage to generate a list of graphs that satisfy particular properties. To do this I "call" a program named "nauty". For example, if I would like to generate all graphs with 10 vertices, 25 edges, and clique number 4 I type the following:

sage: g10=[g for g in graphs.nauty_geng('10 25') if g.clique_number()==4]

Now say that I want to check which of these graphs contain a particular subgraph. For example, say I want to know which one of these graphs contain a 5-cycle. How can I ask Sage to go through the list of graphs in g10 and tell me this information?

Thank you in advance!