How can we effectively shorten the following piece of code:
g=graphs.CirculantGraph(8,[1,2])
v=g.vertices()
v1=set(v)-set([0,4])
v2=set(v)-set([1,5])
v3=set(v)-set([2,6])
v4=set(v)-set([3,7])
v5=set(v)-set([0,5])
v6=set(v)-set([1,4])
v7=set(v)-set([2,7])
v8=set(v)-set([3,6])
g1=g.subgraph(v1)
g2=g.subgraph(v2)
g3=g.subgraph(v3)
g4=g.subgraph(v4)
g5=g.subgraph(v5)
g6=g.subgraph(v6)
g7=g.subgraph(v7)
g8=g.subgraph(v8)
Like, I wish to loop on the indices g(i)
. Instead of writing repeatedly g1=subgraph(v1)
, is there a way to loop arounfd the self defined index g(i)
? Thanks beforehand.