megalist = [['a', 'b'], ['a', 'd'], ['b', 'd'], ['b', 'f'], ['r', 's'], [
    't', 'r']]
G = nx.Graph()
G.add_edges_from(megalist)
Split a tuple of tuples (or list of lists) of paired values into independent complete sets?