code: def collate(samples):
      """collate function for building graph dataloader"""
  
      # generate batched graphs and labels
      graphs, targets = map(list, zip(*samples))
      batched_graph = dgl.batch(graphs)
      batched_targets = th.Tensor(targets)
  
      n_graphs = len(graphs)
      graph_id = th.arange(n_graphs)
      graph_id = dgl.broadcast_nodes(batched_graph, graph_id)
  
      batched_graph.ndata["graph_id"] = graph_id
  
      return batched_graph, batched_targets
  
file_path: dgl/examples/pytorch/infograph/semisupervised.py
imports: import argparse
  import dgl
  import numpy
  import torch
  import torch.nn.functional
  from dgl.data import QM9EdgeDataset
  from dgl.data.utils import Subset
  from dgl.dataloading import GraphDataLoader
  from model import InfoGraphS
label_desc: Use image node_id 2 for calling a global function with example usage: collate(samples) and returns: batched_graph,  batched_targets