code: def extract_unique_edges_from_triangular_mesh(
      faces: type_alias.TensorLike, directed_edges: bool = False
  ) -> type_alias.TensorLike:
      """Extracts all the unique edges using the faces of a mesh.
  
      Args:
        faces: A numpy.ndarray of shape [T, 3], where T is the number of triangular
          faces in the mesh. Each entry in this array describes the index of a
          vertex in the mesh.
        directed_edges: A boolean flag, whether to treat an edge as directed or
          undirected.  If (i, j) is an edge in the mesh and directed_edges is True,
          then both (i, j) and (j, i) are returned in the list of edges. If (i, j)
          is an edge in the mesh and directed_edges is False, then one of (i, j) or
          (j, i) is returned.
  
      Returns:
        A numpy.ndarray of shape [E, 2], where E is the number of edges in
        the mesh.
  
  
        For eg: given faces = [[0, 1, 2], [0, 1, 3]], then
          for directed_edges = False, one valid output is
            [[0, 1], [0, 2], [0, 3], [1, 2], [3, 1]]
          for directed_edges = True, one valid output is
            [[0, 1], [0, 2], [0, 3], [1, 0], [1, 2], [1, 3],
             [2, 0], [2, 1], [3, 0], [3, 1]]
  
  
      Raises:
        ValueError: If `faces` is not a numpy.ndarray or if its shape is not
          supported.
      """
      if not isinstance(faces, np.ndarray):
          raise ValueError("'faces' must be a numpy.ndarray.")
      faces_shape = faces.shape
      faces_rank = len(faces_shape)
      if faces_rank != 2:
          raise ValueError(
              "'faces' must have a rank equal to 2, but it has rank {} and shape {}.".format(
                  faces_rank, faces_shape
              )
          )
      if faces_shape[1] != 3:
          raise ValueError(
              "'faces' must have exactly 3 dimensions in the last axis, but it has {}"
              " dimensions and is of shape {}.".format(
                  faces_shape[1], faces_shape
              )
          )
      edges = np.concatenate(
          [faces[:, 0:2], faces[:, 1:3], faces[:, [2, 0]]], axis=0
      )
      if directed_edges:
          edges = np.concatenate([edges, np.flip(edges, axis=-1)])
      unique_edges = np.unique(edges, axis=0)
      return unique_edges
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensorflow_graphics.util import type_alias
label_desc: Use image node_id 1 for calling a global function with example usage: extract_unique_edges_from_triangular_mesh(faces, directed_edges) and returns: unique_edges