code: def test_dbscan_core_samples_toy(algorithm):
      X = [[0], [2], [3], [4], [6], [8], [10]]
      n_samples = len(X)
  
      # Degenerate case: every sample is a core sample, either with its own
      # cluster or including other close core samples.
      core_samples, labels = dbscan(
          X, algorithm=algorithm, eps=1, min_samples=1
      )
      assert_array_equal(core_samples, np.arange(n_samples))
      assert_array_equal(labels, [0, 1, 1, 1, 2, 3, 4])
  
      # With eps=1 and min_samples=2 only the 3 samples from the denser area
      # are core samples. All other points are isolated and considered noise.
      core_samples, labels = dbscan(
          X, algorithm=algorithm, eps=1, min_samples=2
      )
      assert_array_equal(core_samples, [1, 2, 3])
      assert_array_equal(labels, [-1, 0, 0, 0, -1, -1, -1])
  
      # Only the sample in the middle of the dense area is core. Its two
      # neighbors are edge samples. Remaining samples are noise.
      core_samples, labels = dbscan(
          X, algorithm=algorithm, eps=1, min_samples=3
      )
      assert_array_equal(core_samples, [2])
      assert_array_equal(labels, [-1, 0, 0, 0, -1, -1, -1])
  
      # It's no longer possible to extract core samples with eps=1:
      # everything is noise.
      core_samples, labels = dbscan(
          X, algorithm=algorithm, eps=1, min_samples=4
      )
      assert_array_equal(core_samples, [])
      assert_array_equal(labels, np.full(n_samples, -1.0))
  
imports: import pickle
  import warnings
  import numpy
  import pytest
  from scipy.spatial import distance
  from sklearn.cluster import DBSCAN, dbscan
  from sklearn.cluster.tests.common import generate_clustered_data
  from sklearn.metrics.pairwise import pairwise_distances
  from sklearn.neighbors import NearestNeighbors
  from sklearn.utils._testing import assert_array_equal
  from sklearn.utils.fixes import CSR_CONTAINERS, LIL_CONTAINERS
label_desc: Use image node_id 16 for calling a global function with example usage: test_dbscan_core_samples_toy(algorithm) without return types