code: def init_graph(in_nodes, out_nodes, f_size, device="cpu"):
      src, dst = [], []
      in_indx = list(range(in_nodes))
      out_indx = list(range(in_nodes, in_nodes + out_nodes))
      # add edges use edge broadcasting
      for u in in_indx:
          src += [u] * len(out_indx)
          dst += out_indx
  
      g = dgl.graph((src, dst))  # dgl.graph once;
      g.set_n_initializer(dgl.frame.zero_initializer)
      g = g.to(device)
      g.edata["b"] = th.zeros(in_nodes * out_nodes, 1).to(device)
      return g
  
file_path: dgl/examples/pytorch/capsule/DGLRoutingLayer.py
imports: import dgl
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 2 for calling a global function with example usage: init_graph(in_nodes, out_nodes, f_size, device) and returns: g