[Nauty] select C5-free graphs

lczhangmath lczhangmath at 163.com
Mon Oct 2 17:22:00 AEDT 2023


Hello everyone, 


I would like to know if nauty offers an option to select C5-free graphs. (whether induced or not). Although I know it includes C3-free and C4-free options (-T0 and -W0).  Using some external scripts, for example Python can also do it, or use SageMath:


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


But how should I write the C version? I would like to learn how nauty filters graphs. Of course, I prefer more general options such as subgraph-free (or induced subgraph-free), although they are NP-hard in terms of algorithms.




Best wishes.
Licheng Zhang


More information about the Nauty mailing list