code: def random_partition(num_clusters, graph, shuffle=True):
      """random partition"""
      batch_size = int(math.ceil(graph.num_nodes / num_clusters))
      perm = np.arange(0, graph.num_nodes)
      if shuffle:
          np.random.shuffle(perm)
  
      batch_no = 0
  
      while batch_no < graph.num_nodes:
          batch_nodes = perm[batch_no : batch_no + batch_size]
          batch_no += batch_size
          eids = extract_edges_from_nodes(graph, batch_nodes)
          sub_g = graph.subgraph(
              nodes=batch_nodes,
              eid=eids,
              with_node_feat=True,
              with_edge_feat=False,
          )
          for key, value in graph.edge_feat.items():
              sub_g.edge_feat[key] = graph.edge_feat[key][eids]
          yield sub_g
  
file_path: PGL/ogb_examples/nodeproppred/ogbn-proteins/unimp_cross_feat/partition.py
imports: import numpy
  import math
  from pgl.sample import extract_edges_from_nodes
label_desc: Use image node_id 1 for calling a global function with example usage: random_partition(num_clusters, graph, shuffle) without return types