@@ -0,0 +1,1152 @@
+%0A%0Adef p2c_to_c2p(p2c):%0A    c2p = %7B%7D%0A    nodes_needing_parents = list(p2c)%0A    for parent, children in p2c.items():%0A        if not children:%0A            continue%0A        for child in children:%0A            c2p%5Bchild%5D = parent%0A            nodes_needing_parents.remove(child)%0A    assert len(nodes_needing_parents) == 1%0A    c2p%5Bnodes_needing_parents%5B0%5D%5D = None%0A    return c2p%0A%0A%0Adef test_diff_01():%0A%0A    source_p2c = %7B%0A        'A': ('B', 'C', 'D'),%0A        'B': ('E', 'F'),%0A        'C': None,%0A        'D': ('G', 'H'),%0A        'E': ('I',),%0A        'F': ('J',),%0A        'G': None,%0A        'H': None,%0A        'I': None,%0A        'J': None,%0A        %7D%0A    source_c2p = p2c_to_c2p(source_p2c)%0A%0A    target_p2c = %7B%0A        'A': ('K', 'D', 'B'),%0A        'B': ('M', 'N'),%0A        'C': None,%0A        'D': ('G',),%0A        'G': ('H',),%0A        'H': None,%0A        'J': None,%0A        'K': ('J', 'L'),%0A        'L': None,%0A        'M': ('C',),%0A        'N': None,%0A        %7D%0A    target_c2p = p2c_to_c2p(target_p2c)%0A%0A    initial_node = 'A'%0A%0A    requests = %5B%5D%0A%0A    def recurse(parent, children):%0A        if parent not in target_p2c:%0A            request = ('free', parent)%0A        %0A

Add sketch for tree-diff test.