(
    inputs: List[ArrayIndexType],
    output: ArrayIndexType,
    size_dict: Dict[str, int],
    memory_limit: Optional[int] = None,
    choose_fn: Any = None,
    cost_fn: str = "memory-removed",
)
return ssa_to_linear(ssa_path)
Finds the path by a three stage algorithm:

    1. Eagerly compute Hadamard products.
    2. Greedily compute contractions to maximize `removed_size`
    3. Greedily compute outer products.

    This algorithm scales quadratically with respect to the
    maximum number of elements sharing a common dim.

    **Parameters:**

    - **inputs** - *(list)* List of sets that represent the lhs side of the einsum subscript
    - **output** - *(set)* Set that represents the rhs side of the overall einsum subscript
    - **size_dict** - *(dictionary)* Dictionary of index sizes
    - **memory_limit** - *(int)* The maximum number of elements in a temporary array
    - **choose_fn** - *(callable, optional)* A function that chooses which contraction to perform from the queue
    - **cost_fn** - *(callable, optional)* A function that assigns a potential contraction a cost.

    **Returns:**

    - **path** - *(list)* The contraction order (a list of tuples of ints).

    **Examples:**

    ```python
    isets = [set('abd'), set('ac'), set('bdc')]
    oset = set('')
    idx_sizes = {'a': 1, 'b':2, 'c':3, 'd':4}
    greedy(isets, oset, idx_sizes)
    #> [(0, 2), (0, 1)]
    ```
Finds the path by a three stage algorithm:
Finds the path by a three stage algorithm :
def greedy(
    inputs: List[ArrayIndexType],
    output: ArrayIndexType,
    size_dict: Dict[str, int],
    memory_limit: Optional[int] = None,
    choose_fn: Any = None,
    cost_fn: str = "memory-removed",
) -> PathType:
    """
    Finds the path by a three stage algorithm:

    1. Eagerly compute Hadamard products.
    2. Greedily compute contractions to maximize `removed_size`
    3. Greedily compute outer products.

    This algorithm scales quadratically with respect to the
    maximum number of elements sharing a common dim.

    **Parameters:**

    - **inputs** - *(list)* List of sets that represent the lhs side of the einsum subscript
    - **output** - *(set)* Set that represents the rhs side of the overall einsum subscript
    - **size_dict** - *(dictionary)* Dictionary of index sizes
    - **memory_limit** - *(int)* The maximum number of elements in a temporary array
    - **choose_fn** - *(callable, optional)* A function that chooses which contraction to perform from the queue
    - **cost_fn** - *(callable, optional)* A function that assigns a potential contraction a cost.

    **Returns:**

    - **path** - *(list)* The contraction order (a list of tuples of ints).

    **Examples:**

    ```python
    isets = [set('abd'), set('ac'), set('bdc')]
    oset = set('')
    idx_sizes = {'a': 1, 'b':2, 'c':3, 'd':4}
    greedy(isets, oset, idx_sizes)
    #> [(0, 2), (0, 1)]
    ```
    """
    if memory_limit not in _UNLIMITED_MEM:
        return branch(inputs, output, size_dict, memory_limit, nbranch=1, cost_fn=cost_fn)  # type: ignore

    ssa_path = ssa_greedy_optimize(inputs, output, size_dict, cost_fn=cost_fn, choose_fn=choose_fn)
    return ssa_to_linear(ssa_path)
def greedy ( inputs : List [ ArrayIndexType ] , output : ArrayIndexType , size_dict : Dict [ str , int ] , memory_limit : Optional [ int ] = None , choose_fn : Any = None , cost_fn : str = "memory-removed" , ) -> PathType : if memory_limit not in _UNLIMITED_MEM : return branch ( inputs , output , size_dict , memory_limit , nbranch = 1 , cost_fn = cost_fn ) # type: ignore ssa_path = ssa_greedy_optimize ( inputs , output , size_dict , cost_fn = cost_fn , choose_fn = choose_fn ) return ssa_to_linear ( ssa_path )