code: def spectral_layout(
      data,
      graph,
      dim,
      random_state,
      metric="euclidean",
      metric_kwds={},
      tol=0.0,
      maxiter=0,
  ):
      """
      Given a graph compute the spectral embedding of the graph. This is
      simply the eigenvectors of the laplacian of the graph. Here we use the
      normalized laplacian.
  
      Parameters
      ----------
      data: array of shape (n_samples, n_features)
          The source data
  
      graph: sparse matrix
          The (weighted) adjacency matrix of the graph as a sparse matrix.
  
      dim: int
          The dimension of the space into which to embed.
  
      random_state: numpy RandomState or equivalent
          A state capable being used as a numpy random state.
  
      tol: float, default chosen by implementation
          Stopping tolerance for the numerical algorithm computing the embedding.
  
      maxiter: int, default chosen by implementation
          Number of iterations the numerical algorithm will go through at most as it
          attempts to compute the embedding.
  
      Returns
      -------
      embedding: array of shape (n_vertices, dim)
          The spectral embedding of the graph.
      """
      return _spectral_layout(
          data=data,
          graph=graph,
          dim=dim,
          random_state=random_state,
          metric=metric,
          metric_kwds=metric_kwds,
          init="random",
          tol=tol,
          maxiter=maxiter,
      )
  
file_path: umap/umap/spectral.py
imports: import warnings
  from warnings import warn
  import numpy
  import scipy.sparse
  import scipy.sparse.csgraph
  from sklearn.decomposition import TruncatedSVD
  from sklearn.manifold import SpectralEmbedding
  from sklearn.metrics import pairwise_distances
  from sklearn.metrics.pairwise import _VALID_METRICS
  from umap.distances import pairwise_special_metric, SPECIAL_METRICS
  from umap.sparse import SPARSE_SPECIAL_METRICS, sparse_named_distances
label_desc: Use image node_id 3 for calling a global function with example usage: spectral_layout(data, graph, dim, random_state, metric, metric_kwds, tol, maxiter) and returns: _spectral_layout