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: define the edge and weights array
          
docstr_tok: ["define","the","edge","and","weights","array"]
code: def define_graph_attributes(self):
      """define the edge and weights array"""
      self.edges = np.array([]).astype(np.int_)
      self.weights = np.array([])
      i = np.nonzero(self.parents != np.arange(self.V))[0]
      if np.size(i) > 0:
          E1 = np.hstack((i, self.parents[i]))
          E2 = np.hstack((self.parents[i], i))
          self.edges = (np.vstack((E1, E2))).astype(np.int_).T
          self.weights = np.hstack(
              (np.ones(np.size(i)), -np.ones(np.size(i)))
          )
  
      self.E = np.size(self.weights)
      self.edges = self.edges
  
imports: import numpy
  from .graph import WeightedGraph
label_desc: Use image node_id 2 for calling the Forest obj's underlying member method code with example usage: obj.define_graph_attributes() without return types