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: compute an index for each node: 0 for the leaves, 1 for
  their parents etc. and maximal for the roots.
  
  Returns
  -------
  depth: array of shape (self.V): the depth values of the vertices
docstr_tok: ["compute","an","index","for","each","node",":","0","for","the","leaves",",","1","for","their","parents","etc",".","and","maximal","for","the","roots",".","Returns","--","--","--","-","depth",":","array","of","shape","(","self.V",")",":","the","depth","values","of","the","vertices"]
code: def depth_from_leaves(self):
      """compute an index for each node: 0 for the leaves, 1 for
      their parents etc. and maximal for the roots.
  
      Returns
      -------
      depth: array of shape (self.V): the depth values of the vertices
      """
      depth = self.isleaf().astype(np.int_) - 1
      for j in range(self.V):
          dc = depth.copy()
          for i in range(self.V):
              if self.parents[i] != i:
                  depth[self.parents[i]] = np.maximum(
                      depth[i] + 1, depth[self.parents[i]]
                  )
          if dc.max() == depth.max():
              break
      return depth
  
imports: import numpy
  from .graph import WeightedGraph
label_desc: Use image node_id 12 for calling the Forest obj's underlying member method code with example usage: obj.depth_from_leaves() and returns: depth