Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can have a look at the questions tagged graph_generation for more details and explanations about the following, see https://ask.sagemath.org/questions/scope:all/sort:activity-desc/tags:graph_generation/page:1/

  • being planar is a property that is stable when we remove some edges
  • being C5-free is a property that is stable when we remove some edges
  • being connected is not stable when we remove some edges

Hence, we can first generate all planar and C5-free graphs with the graphs generators (using the augment="edges" option), and then filter the connected ones (the cost is not expensive since we already selected few graphs):

sage: C5 = graphs.CycleGraph(5)
sage: good_graphs = [g for g in graphs(6, property=lambda G: G.is_planar() and not C5.is_subgraph(G,induced=False), augment="edges") if g.is_connected()]

sage: len(good_graphs)

sage: for g in good_graphs:
....:     show(g)
click to hide/show revision 2
No.2 Revision

You can have a look at the questions tagged graph_generation for more details and explanations about the following, see https://ask.sagemath.org/questions/scope:all/sort:activity-desc/tags:graph_generation/page:1/

  • being planar is a property that is stable when we remove some edges
  • being C5-free is a property that is stable when we remove some edges
  • being connected is not stable when we remove some edges

Hence, we can first generate all planar and C5-free graphs with the graphs generators (using the augment="edges" option), and then filter the connected ones (the cost is not expensive since we already selected few graphs):

sage: C5 = graphs.CycleGraph(5)
sage: good_graphs = [g for g in graphs(6, property=lambda G: G.is_planar() and not C5.is_subgraph(G,induced=False), C5.is_subgraph(G,induced=False, up_to_isomorphism=True ), augment="edges") if g.is_connected()]

sage: len(good_graphs)
43

sage: for g in good_graphs:
....:     show(g)