| 1 | initial version |
To get what you want, it's best to relabel the vertices of each copy of the cliques and then add edges to the result. This way, you know exactly what's going on.
def Sier(n, k):
g = graphs.CompleteGraph(n)
h = Graph()
for i in range(1, k + 1):
perm = {u: (i, u) for u in g}
gg = g.relabel(perm=perm, inplace=False)
h.add_edges(gg.edges())
return h
You get
sage: h = Sier(3, 4)
sage: h.vertices()
[(1, 0),
(1, 1),
(1, 2),
(2, 0),
(2, 1),
(2, 2),
(3, 0),
(3, 1),
(3, 2),
(4, 0),
(4, 1),
(4, 2)]
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.