code: def _build_laplacian(data, spacing, mask=None, beta=50):
      l_x, l_y, l_z = tuple(data.shape[i] for i in range(3))
      edges = _make_graph_edges_3d(l_x, l_y, l_z)
      weights = _compute_weights_3d(
          data, spacing, beta=beta, eps=1.0e-10
      )
      if mask is not None:
          edges, weights = _mask_edges_weights(edges, weights, mask)
      lap = _make_laplacian_sparse(edges, weights)
      del edges, weights
      return lap
  
file_path: nilearn/nilearn/_utils/segmentation.py
imports: import warnings
  import numpy
  from scipy import ndimage, sparse
  from scipy.sparse.linalg import cg
  from sklearn.utils import as_float_array
label_desc: Use image node_id 8 for calling a global function with example usage: _build_laplacian(data, spacing, mask, beta) and returns: lap