def _hungarian(cost_matrix):
    state = _HungarianState(cost_matrix)

    # No need to bother with assignments if one of the dimensions
    # of the cost matrix is zero-length.
    step = None if 0 in cost_matrix.shape else _step1

    while step is not None:
        step = step(state)

    # Look for the starred columns
    results = np.array(np.where(state.marked == 1)).T

    # We need to swap the columns because we originally
    # did a transpose on the input cost matrix.
    if state.transposed:
        results = results[:, ::-1]

    return results


# Individual steps of the algorithm follow, as a state machine: they return
# the next step to be taken (function to be called), if any.
Take an arbitrary dictionary of data and index it with ELS.
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/utils/linear_assignment_.py/_hungarian--crossover with--dataset/ETHPy150Open SuperCowPowers/workbench/workbench/server/els_indexer.py/ELSIndexer.index_data