docstr: Adds graph support. Returns DGLGraph.
docstr_tok: ["Adds","graph","support",".","Returns","DGLGraph","."]
code: def _apply_support(self, graph, symm=True):
      """Adds graph support. Returns DGLGraph."""
  
      def _calc_norm(val):
          val = val.numpy().astype("float32")
          val[val == 0.0] = np.inf
          val = torch.FloatTensor(1.0 / np.sqrt(val))
          return val.unsqueeze(1)
  
      user_ci = []
      user_cj = []
      item_ci = []
      item_cj = []
  
      for rating in self.rating_values:
          rating = str(rating).replace(".", "_")
          user_ci.append(graph[f"rev-{rating}"].in_degrees())
          item_ci.append(graph[rating].in_degrees())
  
          if symm:
              user_cj.append(graph[rating].out_degrees())
              item_cj.append(graph[f"rev-{rating}"].out_degrees())
          else:
              user_cj.append(torch.zeros((self.total_users,)))
              item_cj.append(torch.zeros((self.total_items,)))
      user_ci = _calc_norm(sum(user_ci))
      item_ci = _calc_norm(sum(item_ci))
      if symm:
          user_cj = _calc_norm(sum(user_cj))
          item_cj = _calc_norm(sum(item_cj))
      else:
          user_cj = torch.ones(
              self.total_users,
          )
          item_cj = torch.ones(
              self.total_items,
          )
      graph.nodes["user"].data.update({"ci": user_ci, "cj": user_cj})
      graph.nodes["item"].data.update({"ci": item_ci, "cj": item_cj})
  
      return graph
  
imports: import logging
  import time
  from collections import defaultdict
  import torch
  from torch import nn
  import dgl
  import numpy
  import scipy.sparse
  from tqdm import tqdm
  from .nn_modules import NeuralNetwork
  from .utils import get_optimizer, torch_net_info, torch_total_param_num
label_desc: Use image node_id 2 for calling the Model obj's underlying member method code with example usage: obj._apply_support(graph, symm) and returns: graph, val