code: def test_spectral_embedding_amg_solver_failure(dtype, seed=36):
      # Non-regression test for amg solver failure (issue #13393 on github)
      num_nodes = 100
      X = sparse.rand(
          num_nodes, num_nodes, density=0.1, random_state=seed
      )
      X = X.astype(dtype)
      upper = sparse.triu(X) - sparse.diags(X.diagonal())
      sym_matrix = upper + upper.T
      embedding = spectral_embedding(
          sym_matrix,
          n_components=10,
          eigen_solver="amg",
          random_state=0,
      )
  
      # Check that the learned embedding is stable w.r.t. random solver init:
      for i in range(3):
          new_embedding = spectral_embedding(
              sym_matrix,
              n_components=10,
              eigen_solver="amg",
              random_state=i + 1,
          )
          _assert_equal_with_sign_flipping(
              embedding, new_embedding, tol=0.05
          )
  
imports: from unittest.mock import Mock
  import numpy
  import pytest
  from scipy import sparse
  from scipy.linalg import eigh
  from scipy.sparse.linalg import eigsh, lobpcg
  from sklearn.cluster import KMeans
  from sklearn.datasets import make_blobs
  from sklearn.manifold import SpectralEmbedding, _spectral_embedding, spectral_embedding
  from sklearn.manifold._spectral_embedding import _graph_connected_component, _graph_is_connected
  from sklearn.metrics import normalized_mutual_info_score, pairwise_distances
  from sklearn.metrics.pairwise import rbf_kernel
  from sklearn.neighbors import NearestNeighbors
  from sklearn.utils._testing import assert_array_almost_equal, assert_array_equal
  from sklearn.utils.extmath import _deterministic_vector_sign_flip
  from sklearn.utils.fixes import COO_CONTAINERS, CSC_CONTAINERS, CSR_CONTAINERS, parse_version, sp_version
  from sklearn.utils.fixes import laplacian
label_desc: Use image node_id 8 for calling a global function with example usage: test_spectral_embedding_amg_solver_failure(dtype, seed) without return types