code: def collate(samples):
      """collate function for building the graph dataloader"""
      graphs, diff_graphs, labels = map(list, zip(*samples))
  
      # generate batched graphs and labels
      batched_graph = dgl.batch(graphs)
      batched_labels = th.tensor(labels)
      batched_diff_graph = dgl.batch(diff_graphs)
  
      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_diff_graph, batched_labels
  
file_path: dgl/examples/pytorch/mvgrl/graph/main.py
imports: import argparse
  import warnings
  import dgl
  import torch
  from dataset import load
  from dgl.dataloading import GraphDataLoader
  from model import MVGRL
  from utils import linearsvc
label_desc: Use image node_id 1 for calling a global function with example usage: collate(samples) and returns: batched_graph,  batched_diff_graph,  batched_labels