code: def _label(parent):
      # find the root
      root = np.nonzero(parent == np.arange(np.size(parent)))[0]
  
      # define left
      left = np.zeros(np.size(parent))
      for f in range(np.size(parent)):
          temp = np.nonzero(parent == f)
          if np.size(temp) > 0:
              left[temp[0][0]] = 1
  
      left[root] = 0.5
  
      # define labelled
      labelled = -np.ones(np.size(parent))
  
      # compute labelled
      for j in range(np.size(root)):
          labelled = _label_(root[j], parent, left, labelled)
  
      return labelled
  
imports: from warnings import warn
  import numpy
  from ..graph.forest import Forest
  from ..graph.graph import WeightedGraph
label_desc: Use image node_id 15 for calling a global function with example usage: _label(parent) and returns: labelled