1 | initial version |
You can unroll the construction for L
to an early break:
def l_kcycles(G,l,k):
H = graphs.CycleGraph(k)
L = set()
for g in G.subgraph_search_iterator(H, induced=False):
L.add( tuple(g.edges(labels=False,sort_vertices=True,sort=True)) )
if len(L)>l:
return False
return len(L)==l