code: def set_tweight(self, node, weight_source, weight_sink):
          r
          if node >= self.__nodes or node < 0:
              raise ValueError('Invalid node id of {}. Valid values are 0 to {}.'.format(node, self.__nodes - 1))
          self.__graph.add_tweights(int(node), float(weight_source), float(weight_sink))
docs: r"""
          Set a single t-weight / terminal-weight.
          
          Parameters
          ----------
          node : int
              Node-id for which to set the terminal weights.
          weight_source : float
              Weight to source terminal.
          weight_sink : float
              Weight to sink terminal.
          
          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).
              
          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 inefficient.
                
          Terminal weights can be zero or negative.