parameters: (cost_matrix)
return_statement: return results
docstring: The Hungarian algorithm.
  
      Calculate the Munkres solution to the classical assignment problem and
      return the indices for the lowest-cost pairings.
  
      Parameters
      ----------
      cost_matrix : 2D matrix
          The cost matrix. Does not have to be square.
  
      Returns
      -------
      indices : 2D array of indices
          The pairs of (row, col) indices in the original array giving
          the original ordering.
docstring_summary: The Hungarian algorithm.
docstring_tokens: The Hungarian algorithm .
function: def _hungarian(cost_matrix):
      """The Hungarian algorithm.
  
      Calculate the Munkres solution to the classical assignment problem and
      return the indices for the lowest-cost pairings.
  
      Parameters
      ----------
      cost_matrix : 2D matrix
          The cost matrix. Does not have to be square.
  
      Returns
      -------
      indices : 2D array of indices
          The pairs of (row, col) indices in the original array giving
          the original ordering.
      """
      warnings.warn(
          "The linear_assignment function is deprecated in 0.21 "
          "and will be removed from 0.23. Use "
          "scipy.optimize.linear_sum_assignment instead.",
          FutureWarning)
  
      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
function_tokens: def _hungarian ( cost_matrix ) : warnings . warn ( "The linear_assignment function is deprecated in 0.21 " "and will be removed from 0.23. Use " "scipy.optimize.linear_sum_assignment instead." , FutureWarning ) 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