1 | initial version |
You can use list comprehension:
G = graphs.CirculantGraph(8,[1,2])
v = G.vertices()
u = [[0,4], [1,5], [2,6], [3,7], [0,5], [1,4], [2,7], [3,6]]
g = [G.subgraph(set(v) - set(s)) for s in u]
You can refer to the $i$-th subgraph by g[i]
. You can loop around as usual in Python. For example,
for sg in g:
show(sg)
or
for i in range(len(g)):
show(g[i])