code: def test_ClusterNodeSquence():
      G = create_stellargraph()
  
      generator = ClusterNodeGenerator(G, clusters=1, q=1).flow(
          node_ids=["a", "b", "c", "d"]
      )
  
      assert len(generator) == 1
  
      generator = ClusterNodeGenerator(G, clusters=4, q=1).flow(
          node_ids=["a", "b", "c", "d"]
      )
      assert len(generator) == 4
  
      generator = ClusterNodeGenerator(G, clusters=4, q=1).flow(
          node_ids=["a", "b", "c", "d"]
      )
  
      # ClusterNodeSequence returns the following:
      #      [features, target_node_indices, adj_cluster], cluster_targets
      for batch in generator:
          assert len(batch) == 2
          # The first dimension is the batch dimension necessary to make this work with Keras
          assert batch[0][0].shape == (1, 1, 2)
          assert batch[0][1].shape == (1, 1)
          # one node so that adjacency matrix is 1x1
          assert batch[0][2].shape == (1, 1, 1)
          # no targets given
          assert batch[1] is None
  
      # Use 2 clusters
      generator = ClusterNodeGenerator(G, clusters=2, q=1).flow(
          node_ids=["a", "b", "c", "d"]
      )
      assert len(generator) == 2
  
      # ClusterNodeSequence returns the following:
      #      [features, target_node_indices, adj_cluster], cluster_targets
      for batch in generator:
          assert len(batch) == 2
          # The first dimension is the batch dimension necessary to make this work with Keras
          assert batch[0][0].shape == (1, 2, 2)
          assert batch[0][1].shape == (1, 2)
          # two nodes so that adjacency matrix is 2x2
          assert batch[0][2].shape == (1, 2, 2)
          # no targets given
          assert batch[1] is None
  
file_path: stellargraph/tests/mapper/test_cluster_gcn_node_mapper.py
imports: from stellargraph.mapper import ClusterNodeGenerator, ClusterNodeSequence
  from stellargraph.core.graph import StellarGraph
  import pandas
  import numpy
  import pytest
  from ..test_utils.graphs import example_graph_random
label_desc: Use image node_id 5 for calling a global function with example usage: test_ClusterNodeSquence() without return types