class_docstr: Forest structure, i.e. a set of trees
  
  The nodes can be segmented into trees.
  
  Within each tree a node has one parent and children
  that describe the associated hierarchical structure.
  Some of the nodes can be viewed as leaves, other as roots
  The edges within a tree are associated with a weight:
  
  * +1 from child to parent
  * -1 from parent to child
  
  Attributes
  ----------
  V : int
      int > 0, the number of vertices
  E : int
      the number of edges
  parents : (self.V,) array
      the parent array
  edges : (self.E, 2) array
      representing pairwise neighbors
  weights : (self.E,) array
      +1/-1 for ascending/descending links
  children: list
      list of arrays that represents the children any node
class_docstr_tok: ["Forest","structure",",","i.e",".","a","set","of","trees","The","nodes","can","be","segmented","into","trees",".","Within","each","tree","a","node","has","one","parent","and","children","that","describe","the","associated","hierarchical","structure",".","Some","of","the","nodes","can","be","viewed","as","leaves",",","other","as","roots","The","edges","within","a","tree","are","associated","with","a","weight",":","*","+1","from","child","to","parent","*","-1","from","parent","to","child","Attributes","--","--","--","--","--","V",":","int","int",">","0",",","the","number","of","vertices","E",":","int","the","number","of","edges","parents",":","(","self.V",",",")","array","the","parent","array","edges",":","(","self.E",",","2",")","array","representing","pairwise","neighbors","weights",":","(","self.E",",",")","array","+1\/-1","for","ascending\/descending","links","children",":","list","list","of","arrays","that","represents","the","children","any","node"]
docstr: Propagation of a certain labelling from leaves to roots
  Assuming that label is a certain positive integer field
  this propagates these labels to the parents whenever
  the children nodes have coherent properties
  otherwise the parent value is unchanged
  
  Parameters
  ----------
  label: array of shape(self.V)
  
  Returns
  -------
  label: array of shape(self.V)
docstr_tok: ["Propagation","of","a","certain","labelling","from","leaves","to","roots","Assuming","that","label","is","a","certain","positive","integer","field","this","propagates","these","labels","to","the","parents","whenever","the","children","nodes","have","coherent","properties","otherwise","the","parent","value","is","unchanged","Parameters","--","--","--","--","--","label",":","array","of","shape","(","self.V",")","Returns","--","--","--","-","label",":","array","of","shape","(","self.V",")"]
code: def propagate_upward(self, label):
      """Propagation of a certain labelling from leaves to roots
      Assuming that label is a certain positive integer field
      this propagates these labels to the parents whenever
      the children nodes have coherent properties
      otherwise the parent value is unchanged
  
      Parameters
      ----------
      label: array of shape(self.V)
  
      Returns
      -------
      label: array of shape(self.V)
      """
      label = np.asanyarray(label).copy()
      if np.size(label) != self.V:
          raise ValueError("incoherent size for label")
  
      ch = self.get_children()
      depth = self.depth_from_leaves()
      for j in range(1, depth.max() + 1):
          for i in range(self.V):
              if depth[i] == j:
                  if np.size(np.unique(label[ch[i]])) == 1:
                      label[i] = np.unique(label[ch[i]])
      return label
  
imports: import numpy
  from .graph import WeightedGraph
label_desc: Use image node_id 17 for calling the Forest obj's underlying member method code with example usage: obj.propagate_upward(label) and returns: label