code: def weight_boundary(graph, src, dst, n):
      """
      Handle merging of nodes of a region boundary region adjacency graph.
  
      This function computes the `"weight"` and the count `"count"`
      attributes of the edge between `n` and the node formed after
      merging `src` and `dst`.
  
  
      Parameters
      ----------
      graph : RAG
          The graph under consideration.
      src, dst : int
          The vertices in `graph` to be merged.
      n : int
          A neighbor of `src` or `dst` or both.
  
      Returns
      -------
      data : dict
          A dictionary with the "weight" and "count" attributes to be
          assigned for the merged node.
  
      """
      default = {"weight": 0.0, "count": 0}
  
      count_src = graph[src].get(n, default)["count"]
      count_dst = graph[dst].get(n, default)["count"]
  
      weight_src = graph[src].get(n, default)["weight"]
      weight_dst = graph[dst].get(n, default)["weight"]
  
      count = count_src + count_dst
      return {
          "count": count,
          "weight": (count_src * weight_src + count_dst * weight_dst)
          / count,
      }
  
imports: from skimage import data, segmentation, filters, color
  from skimage import graph
  from matplotlib import pyplot
label_desc: Use image node_id 1 for calling a global function with example usage: weight_boundary(graph, src, dst, n) and returns: dict