code: def _compute_ch_adjacency(info, ch_type):
      """Compute channel adjacency matrix using Delaunay triangulations.
  
      Parameters
      ----------
      %(info_not_none)s
      ch_type : str
          The channel type for computing the adjacency matrix. Currently
          supports ``'mag'``, ``'grad'`` and ``'eeg'``.
  
      Returns
      -------
      ch_adjacency : scipy.sparse.csr_matrix, shape (n_channels, n_channels)
          The adjacency matrix.
      ch_names : list
          The list of channel names present in adjacency matrix.
      """
      from ..channels.layout import (
          _find_topomap_coords,
          _pair_grad_sensors,
      )
      from ..source_estimate import spatial_tris_adjacency
  
      combine_grads = ch_type == "grad" and any(
          [
              coil_type in [ch["coil_type"] for ch in info["chs"]]
              for coil_type in [
                  FIFF.FIFFV_COIL_VV_PLANAR_T1,
                  FIFF.FIFFV_COIL_NM_122,
              ]
          ]
      )
  
      picks = dict(_picks_by_type(info, exclude=[]))[ch_type]
      ch_names = [info["ch_names"][pick] for pick in picks]
      if combine_grads:
          pairs = _pair_grad_sensors(
              info, topomap_coords=False, exclude=[]
          )
          if len(pairs) != len(picks):
              raise RuntimeError(
                  "Cannot find a pair for some of the "
                  "gradiometers. Cannot compute adjacency "
                  "matrix."
              )
          # only for one of the pair
          xy = _find_topomap_coords(
              info, picks[::2], sphere=HEAD_SIZE_DEFAULT
          )
      else:
          xy = _find_topomap_coords(
              info, picks, sphere=HEAD_SIZE_DEFAULT
          )
      tri = Delaunay(xy)
      neighbors = spatial_tris_adjacency(tri.simplices)
  
      if combine_grads:
          ch_adjacency = np.eye(len(picks), dtype=bool)
          for idx, neigbs in zip(neighbors.row, neighbors.col):
              for ii in range(2):  # make sure each pair is included
                  for jj in range(2):
                      ch_adjacency[idx * 2 + ii, neigbs * 2 + jj] = True
                      ch_adjacency[
                          idx * 2 + ii, idx * 2 + jj
                      ] = True  # pair
          ch_adjacency = csr_matrix(ch_adjacency)
      else:
          ch_adjacency = lil_matrix(neighbors)
          ch_adjacency.setdiag(np.repeat(1, ch_adjacency.shape[0]))
          ch_adjacency = ch_adjacency.tocsr()
  
      return ch_adjacency, ch_names
  
imports: import os.path
  import string
  import sys
  from collections import OrderedDict
  from copy import deepcopy
  from dataclasses import dataclass
  from functools import partial
  from pathlib import Path
  from typing import Union
  import numpy
  from scipy.io import loadmat
  from scipy.sparse import csr_matrix, lil_matrix
  from scipy.spatial import Delaunay
  from scipy.stats import zscore
  from .._fiff.constants import FIFF
  from .._fiff.meas_info import Info, MontageMixin, _merge_info, _rename_comps, _unit2human, create_info
  from .._fiff.pick import _check_excludes_includes, _pick_data_channels, _picks_by_type, _picks_to_idx, _second_rules, channel_indices_by_type, channel_type, pick_channels, pick_info, pick_types
  from .._fiff.proj import setup_proj
  from .._fiff.reference import add_reference_channels, set_eeg_reference
  from .._fiff.tag import _rename_list
  from ..bem import _check_origin
  from ..defaults import HEAD_SIZE_DEFAULT, _handle_default
  from ..utils import _check_dict_keys, _check_fname, _check_option, _check_preload, _get_stim_channel, _on_missing, _validate_type, fill_doc, legacy, logger, verbose, warn
label_desc: Use image node_id 10 for calling a global function with example usage: _compute_ch_adjacency(info, ch_type) and returns: ch_adjacency,  ch_names