I am trying to create a list of subsets of n of length 3. However, my approaches are quite slow, and it takes a while to run the whole program.
My "code" so far is just the generic iterative approach.
subs = []
for a in vertices:
for b in vertices:
for c in vertices:
if sorted([a, b, c]) not in subs and a != b and b != c:
subs.append(sorted([a, b, c]))
This is quite slow, but I'm not sure exactly how I could speed it up. Could anyone help?