Given that:
g=[[], [], [0, 2], [1, 5], [0, 2, 3, 7], [4, 6], [1, 4, 5, 6], [], [], [3, 7]]
How can I compare each list within g so that for
Here's a quickie that will give a list of all the sets that intersect:
sets = [set(i+j) for i in g for j in g if i!=j and (set(i) & set(j))]
Note that each result will be repeated, since each list is being compared twice, once on the left and once on the right.