children = {(1): [2, 3, 4, 5, 6, 7, 8], (2): [3, 4, 5, 6, 7, 8, 9], (3): [9,
    10], (4): [9, 10], (5): [9, 10], (6): [9, 10], (7): [9, 10], (8): [9, 
    10], (9): [10], (10): [11, 12, 13], (11): [14, 15], (12): [13, 14, 15],
    (13): [16, 17], (14): [16, 17], (15): [16, 17], (16): [18], (17): [18],
    (18): [19, 20], (19): [21, 22], (20): [21, 22], (21): [], (22): []}
parents = defaultdict(list)
for a, bs in children.items():
    for b in bs:
        parents[b].append(a)
store = defaultdict(list)
for node in children.keys():
    store[tuple(sorted(children[node])), tuple(sorted(parents[node]))].append(
        node)
for s in store.values():
    if len(s) > 1:
        pass
How to identify unconnected siblings in a graph?