class_docstr: This is a weighted Forest structure, i.e. a tree
  - each node has one parent and children
  (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
  - additionally, the nodes have a value, which is called 'height',
  especially useful from dendrograms
  
  members
  -------
  V : (int, >0) the number of vertices
  E : (int) the number of edges
  parents: array of shape (self.V) the parent array
  edges: array of shape (self.E,2) reprensenting pairwise neighbors
  weights, array of shape (self.E), +1/-1 for scending/descending links
  children: list of arrays that represents the childs of any node
  height: array of shape(self.V)
class_docstr_tok: ["This","is","a","weighted","Forest","structure",",","i.e",".","a","tree","-","each","node","has","one","parent","and","children","(","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","-","additionally",",","the","nodes","have","a","value",",","which","is","called","'height","'",",","especially","useful","from","dendrograms","members","--","--","--","-","V",":","(","int",",",">","0",")","the","number","of","vertices","E",":","(","int",")","the","number","of","edges","parents",":","array","of","shape","(","self.V",")","the","parent","array","edges",":","array","of","shape","(","self.E,2",")","reprensenting","pairwise","neighbors","weights",",","array","of","shape","(","self.E",")",",","+1\/-1","for","scending\/descending","links","children",":","list","of","arrays","that","represents","the","childs","of","any","node","height",":","array","of","shape","(","self.V",")"]
docstr: Parameters
  ----------
  V: the number of edges of the graph
  parents=None: array of shape (V)
          the parents of the graph
          by default, the parents are set to range(V), i.e. each
          node is its own parent, and each node is a tree
  height=None: array of shape(V)
               the height of the nodes
docstr_tok: ["Parameters","--","--","--","--","--","V",":","the","number","of","edges","of","the","graph","parents=None",":","array","of","shape","(","V",")","the","parents","of","the","graph","by","default",",","the","parents","are","set","to","range","(","V",")",",","i.e",".","each","node","is","its","own","parent",",","and","each","node","is","a","tree","height=None",":","array","of","shape","(","V",")","the","height","of","the","nodes"]
code: def __init__(self, V, parents=None, height=None):
      """
      Parameters
      ----------
      V: the number of edges of the graph
      parents=None: array of shape (V)
              the parents of the graph
              by default, the parents are set to range(V), i.e. each
              node is its own parent, and each node is a tree
      height=None: array of shape(V)
                   the height of the nodes
      """
      V = int(V)
      if V < 1:
          raise ValueError("cannot create graphs with no vertex")
      self.V = int(V)
  
      # define the parents
      if parents is None:
          self.parents = np.arange(self.V)
      else:
          if np.size(parents) != V:
              raise ValueError("Incorrect size for parents")
          if parents.max() > self.V:
              raise ValueError("Incorrect value for parents")
          self.parents = np.reshape(parents, self.V)
  
      self.define_graph_attributes()
  
      if self.check() == 0:
          raise ValueError("The proposed structure is not a forest")
      self.children = []
  
      if height is None:
          height = np.zeros(self.V)
      else:
          if np.size(height) != V:
              raise ValueError("Incorrect size for height")
          self.height = np.reshape(height, self.V)
  
imports: from warnings import warn
  import numpy
  from ..graph.forest import Forest
  from ..graph.graph import WeightedGraph
label_desc: Use image node_id 1 to create a new WeightedForest object from inherited base classes: Forest with example: obj = WeightedForest(V, parents, height)