code: def _compute_sparse_morph(
      vertices_from, subject_from, subject_to, subjects_dir=None
  ):
      """Get nearest vertices from one subject to another."""
      from scipy import sparse
  
      maps = read_morph_map(subject_to, subject_from, subjects_dir)
      cnt = 0
      vertices = list()
      cols = list()
      for verts, map_hemi in zip(vertices_from, maps):
          vertno_h = _sparse_argmax_nnz_row(map_hemi[verts])
          order = np.argsort(vertno_h)
          cols.append(cnt + order)
          vertices.append(vertno_h[order])
          cnt += len(vertno_h)
      cols = np.concatenate(cols)
      rows = np.arange(len(cols))
      data = np.ones(len(cols))
      morph_mat = sparse.coo_matrix(
          (data, (rows, cols)), shape=(len(cols), len(cols))
      ).tocsr()
      return vertices, morph_mat
  
imports: import copy
  import os.path
  import warnings
  import numpy
  from scipy import sparse
  from .fixes import _get_img_fdata
  from .morph_map import read_morph_map
  from .parallel import parallel_func
  from .source_estimate import _BaseSourceEstimate, _BaseSurfaceSourceEstimate, _BaseVolSourceEstimate, _get_ico_tris
  from .source_space._source_space import SourceSpaces, _ensure_src, _grid_interp
  from .surface import _compute_nearest, mesh_edges, read_surface
  from .utils import BunchConst, ProgressBar, _check_fname, _check_option, _custom_lru_cache, _ensure_int, _import_h5io_funcs, _import_nibabel, _validate_type, check_version, fill_doc, get_subjects_dir, logger, use_log_level, verbose, warn
  from .utils import warn
label_desc: Use image node_id 2 for calling a global function with example usage: _compute_sparse_morph(vertices_from, subject_from, subject_to, subjects_dir) and returns: vertices,  morph_mat