class_docstr: A graph representation that works directly with the maxflow.GraphDouble graph as
  base. It is therefore less flexible as graph.Graph, but leads to lower memory
  requirements.
  
  The graph contains nodes, edges (directed) between the nodes (n-edges), edges
  between two terminals (called source and sink) and the nodes (t-edges), and a
  weight for each edge. 
  
  Notes
  -----
  The node-ids used by the graph are assumed to start with 0 and be
  continuous. This is not actually checked, so be careful.
  
  This wrapper tries to catch the most usual exception that can occur in the
  underlying C++ implementation and to convert them into catchable and meaningful
  error messages.
docstr: Set a single n-weight / edge-weight.
  
  Parameters
  ----------
  node_from : int
      Node-id from the first node of the edge.
  node_to : int
      Node-id from the second node of the edge.
  weight_there : float
      Weight from first to second node (>0). 
  weight_back : float
      Weight from second to first node (>0).
  
  Raises
  ------
  ValueError
      If a passed node id does not refer to any node of the graph
      (i.e. it is either higher than the initially set number of
      nodes or lower than zero).
  ValueError
      If the two node-ids of the edge are the same (graph cut does
      not allow self-edges).
  ValueError
      If one of the passed weights is <= 0.
      
  Notes
  -----
  The object does not check if the number of supplied edges in total exceeds
  the number passed to the init-method. If this is the case, the underlying
  C++ implementation will double the memory, which is very unefficient.
  
  The underlying C++ implementation allows zero weights, but these are highly
  undesirable for inter-node weights and therefore raise an error.
docstr_tok: ["Set","a","single","n-weight","\/","edge-weight",".","Parameters","--","--","--","--","--","node_from",":","int","Node-id","from","the","first","node","of","the","edge",".","node_to",":","int","Node-id","from","the","second","node","of","the","edge",".","weight_there",":","float","Weight","from","first","to","second","node","(",">","0",")",".","weight_back",":","float","Weight","from","second","to","first","node","(",">","0",")",".","Raises","--","--","--","ValueError","If","a","passed","node","id","does","not","refer","to","any","node","of","the","graph","(","i.e",".","it","is","either","higher","than","the","initially","set","number","of","nodes","or","lower","than","zero",")",".","ValueError","If","the","two","node-ids","of","the","edge","are","the","same","(","graph","cut","does","not","allow","self-edges",")",".","ValueError","If","one","of","the","passed","weights","is","<","=","0",".","Notes","--","--","-","The","object","does","not","check","if","the","number","of","supplied","edges","in","total","exceeds","the","number","passed","to","the","init-method",".","If","this","is","the","case",",","the","underlying","C++","implementation","will","double","the","memory",",","which","is","very","unefficient",".","The","underlying","C++","implementation","allows","zero","weights",",","but","these","are","highly","undesirable","for","inter-node","weights","and","therefore","raise","an","error","."]
code: def set_nweight(self, node_from, node_to, weight_there, weight_back):
      r"""
      Set a single n-weight / edge-weight.
  
      Parameters
      ----------
      node_from : int
          Node-id from the first node of the edge.
      node_to : int
          Node-id from the second node of the edge.
      weight_there : float
          Weight from first to second node (>0).
      weight_back : float
          Weight from second to first node (>0).
  
      Raises
      ------
      ValueError
          If a passed node id does not refer to any node of the graph
          (i.e. it is either higher than the initially set number of
          nodes or lower than zero).
      ValueError
          If the two node-ids of the edge are the same (graph cut does
          not allow self-edges).
      ValueError
          If one of the passed weights is <= 0.
  
      Notes
      -----
      The object does not check if the number of supplied edges in total exceeds
      the number passed to the init-method. If this is the case, the underlying
      C++ implementation will double the memory, which is very unefficient.
  
      The underlying C++ implementation allows zero weights, but these are highly
      undesirable for inter-node weights and therefore raise an error.
      """
      if node_from >= self.__nodes or node_from < 0:
          raise ValueError(
              "Invalid node id (node_from) of {}. Valid values are 0 to {}.".format(
                  node_from, self.__nodes - 1
              )
          )
      elif node_to >= self.__nodes or node_to < 0:
          raise ValueError(
              "Invalid node id (node_to) of {}. Valid values are 0 to {}.".format(
                  node_to, self.__nodes - 1
              )
          )
      elif node_from == node_to:
          raise ValueError(
              "The node_from ({}) can not be equal to the node_to ({}) (self-connections are forbidden in graph cuts).".format(
                  node_from, node_to
              )
          )
      elif weight_there <= 0 or weight_back <= 0:
          raise ValueError("Negative or zero weights are not allowed.")
      self.__graph.sum_edge(
          int(node_from),
          int(node_to),
          float(weight_there),
          float(weight_back),
      )
  
imports: from .maxflow import GraphDouble, GraphFloat
label_desc: Use image node_id 4 for calling the GCGraph obj's underlying member method code with example usage: obj.set_nweight(node_from, node_to, weight_there, weight_back) without return types