code: def chuliu_edmonds_one_root(scores):
      """"""
  
      scores = scores.astype(np.float64)
      tree = chuliu_edmonds(scores)
      roots_to_try = np.where(np.equal(tree[1:], 0))[0] + 1
      if len(roots_to_try) == 1:
          return tree
  
      # -------------------------------------------------------------
      def set_root(scores, root):
          root_score = scores[root, 0]
          scores = np.array(scores)
          scores[1:, 0] = -float("inf")
          scores[root] = -float("inf")
          scores[root, 0] = 0
          return scores, root_score
  
      # -------------------------------------------------------------
  
      best_score, best_tree = (
          -np.inf,
          None,
      )  # This is what's causing it to crash
      for root in roots_to_try:
          _scores, root_score = set_root(scores, root)
          _tree = chuliu_edmonds(_scores)
          tree_probs = _scores[np.arange(len(_scores)), _tree]
          tree_score = (
              (tree_probs).sum() + (root_score)
              if (tree_probs > -np.inf).all()
              else -np.inf
          )
          if tree_score > best_score:
              best_score = tree_score
              best_tree = _tree
      try:
          assert best_tree is not None
      except:
          with open("debug.log", "w") as f:
              f.write("{}: {}, {}\n".format(tree, scores, roots_to_try))
              f.write(
                  "{}: {}, {}, {}\n".format(
                      _tree, _scores, tree_probs, tree_score
                  )
              )
          raise
      return best_tree
  
imports: import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: chuliu_edmonds_one_root(scores) and returns: best_tree, tree, scores,  root_score