def linear_to_ssa(path: PathType) -> PathType:
    """Convert a path with recycled linear ids to a path with static single
    assignment ids.

    Exmaple:
        ```python
        linear_to_ssa([(0, 3), (1, 2), (0, 1)])
        #> [(0, 3), (2, 4), (1, 5)]
        ```
    """
    num_inputs = sum(map(len, path)) - len(path) + 1
    linear_to_ssa = list(range(num_inputs))
    new_ids = itertools.count(num_inputs)
    ssa_path = []
    for ids in path:
        ssa_path.append(tuple(linear_to_ssa[id_] for id_ in ids))
        for id_ in sorted(ids, reverse=True):
            del linear_to_ssa[id_]
        linear_to_ssa.append(next(new_ids))
    return ssa_path
Convert a path with recycled linear ids to a path with static single
    assignment ids.

    Exmaple:
        ```python
        linear_to_ssa([(0, 3), (1, 2), (0, 1)])
        #> [(0, 3), (2, 4), (1, 5)]
        ```
    
opt_einsum/paths.py