code: def graphcuts_general():
      """Graph cuts for general s-t graph optimization."""
  
      num_nodes = 5
      num_edges = 6
  
      g = sg.GraphCut(num_nodes, num_edges)
  
      # add termainal-connected edges
      # i.e., SOURCE->node_i and node_i->SINK
      g.add_tweights(0, 4, 0)
      g.add_tweights(1, 2, 0)
      g.add_tweights(2, 8, 0)
      g.add_tweights(2, 0, 4)
      g.add_tweights(3, 0, 7)
      g.add_tweights(4, 0, 5)
  
      # add node to node edges
      g.add_edge(0, 2, 5, 0)
      g.add_edge(0, 3, 2, 0)
      g.add_edge(1, 2, 6, 0)
      g.add_edge(1, 4, 9, 0)
      g.add_edge(2, 3, 1, 0)
      g.add_edge(2, 4, 3, 0)
  
      # initialize max-flow algorithm
      g.init_maxflow()
  
      # compute max flow
      flow = g.compute_maxflow()
  
file_path: shogun/examples/undocumented/python/structure_graphcuts.py
imports: import numpy
  import itertools
  import shogun
label_desc: Use image node_id 6 for calling a global function with example usage: graphcuts_general() without return types