code: def unique_edges(faces, return_mapping=False):
      """Extract all unique edges from given triangular faces.
  
      Parameters
      ----------
      faces : (N, 3) ndarray
          Vertex indices forming triangular faces.
      return_mapping : bool
          If true, a mapping to the edges of each face is returned.
  
      Returns
      -------
      edges : (N, 2) ndarray
          Unique edges.
      mapping : (N, 3)
          For each face, [x, y, z], a mapping to it's edges [a, b, c].
          ::
  
                  y
                  /\
                 /  \
               a/    \b
               /      \
              /        \
             /__________\
            x      c     z
  
      """
      faces = np.asarray(faces)
      edges = np.concatenate(
          [faces[:, 0:2], faces[:, 1:3], faces[:, ::2]]
      )
      if return_mapping:
          ue, inverse = unique_sets(edges, return_inverse=True)
          return ue, inverse.reshape((3, -1)).T
      else:
          return unique_sets(edges)
  
imports: import numpy
  import warnings
  from scipy import optimize
  from dipy.core.geometry import cart2sphere, sphere2cart, vector_norm
  from dipy.core.onetime import auto_attr
  from dipy.reconst.recspeed import remove_similar_vertices
label_desc: Use image node_id 4 for calling a global function with example usage: unique_edges(faces, return_mapping) and returns: ue,  inverse, unique_sets