code: def make_graph(
      raw_graph,
      prune_culdesacs=False,
      prune_unconnected=True,
      q_vocab=None,
      i_vocab=None,
      ans_vocab=None,
      include_reverse_relations=False,
  ):
      # None edge cases
      if q_vocab is None:
          q_vocab = []
      q_vocab = set(q_vocab)
      if i_vocab is None:
          i_vocab = []
      i_vocab = set(i_vocab)
      if ans_vocab is None:
          ans_vocab = []
      ans_vocab = set(ans_vocab)
  
      # Init nx graph
      graph = nx.DiGraph()
  
      # Add the nodes
      for concept in raw_graph["concepts2idx"]:
          # Add node type info
          q_node = concept in q_vocab
          i_node = concept in i_vocab
          ans_node = concept in ans_vocab
  
          # Add node
          graph.add_node(
              concept, q_node=q_node, i_node=i_node, ans_node=ans_node
          )
  
      # Go through edges in raw_graph
      for triplet in raw_graph["triplets"]:
          # Get triplet
          head_idx = triplet[0]
          rel_idx = triplet[1]
          tail_idx = triplet[2]
  
          # Get the names
          head = raw_graph["concepts"][head_idx]
          tail = raw_graph["concepts"][tail_idx]
          rel = raw_graph["relations"][rel_idx]
  
          # Add to the graph
          assert head in graph.nodes and tail in graph.nodes
          graph.add_edge(head, tail, relation=rel)
  
      # Prune totally unconnected nodes
      if prune_unconnected:
          for concept in raw_graph["concepts2idx"]:
              assert concept in graph.nodes
  
              # Get edges to/from that node
              connecting_edges = list(graph.in_edges(concept)) + list(
                  graph.out_edges(concept)
              )
  
              # Remove if there are no edges
              if len(connecting_edges) == 0:
                  graph.remove_node(concept)
  
      # Prune graph of nodes
      # Custom concepts to remove
      to_remove = [""]
      for concept in to_remove:
          if concept in graph.nodes:
              graph.remove_node(concept)
  
      # Get the idx graph for easy conversions
      graph_idx = convert_node_labels_to_integers(graph)
  
      # Also go ahead and return dicts and edge_type and edge_index
      edge_index, edge_type = get_edge_idx_type(
          graph,
          graph_idx,
          raw_graph["relations2idx"],
          include_reverse_relations,
      )
  
      return graph, graph_idx, edge_index, edge_type
  
imports: import os
  import pickle
  import networkx
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from gensim.models import KeyedVectors
  from gensim.scripts.glove2word2vec import glove2word2vec
  from mmf.common.registry import registry
  from mmf.models.base_model import BaseModel
  from mmf.utils.text import VocabDict
  from networkx import convert_node_labels_to_integers
  from torch_geometric.nn import BatchNorm, GCNConv, RGCNConv, SAGEConv
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: make_graph(raw_graph, prune_culdesacs, prune_unconnected, q_vocab, i_vocab, ans_vocab, include_reverse_relations) and returns: graph,  graph_idx,  edge_index,  edge_type