code: def _build_graph(
      self, features, cluster_features, labels, density, knns
  ):
      adj = fast_knns2spmat(knns, self.k)
      adj, adj_row_sum = row_normalize(adj)
      indices, values, shape = sparse_mx_to_indices_values(adj)
  
      g = dgl.graph((indices[1], indices[0]))
      g.ndata["features"] = torch.FloatTensor(features)
      g.ndata["cluster_features"] = torch.FloatTensor(cluster_features)
      g.ndata["labels"] = torch.LongTensor(labels)
      g.ndata["density"] = torch.FloatTensor(density)
      g.edata["affine"] = torch.FloatTensor(values)
      # A Bipartite from DGL sampler will not store global eid, so we explicitly save it here
      g.edata["global_eid"] = g.edges(form="eid")
      g.ndata["norm"] = torch.FloatTensor(adj_row_sum)
      g.apply_edges(
          lambda edges: {
              "raw_affine": edges.data["affine"] / edges.dst["norm"]
          }
      )
      g.apply_edges(
          lambda edges: {
              "labels_conn": (
                  edges.src["labels"] == edges.dst["labels"]
              ).long()
          }
      )
      g.apply_edges(
          lambda edges: {
              "mask_conn": (
                  edges.src["density"] > edges.dst["density"]
              ).bool()
          }
      )
      return g
  
file_path: dgl/examples/pytorch/hilander/dataset/dataset.py
imports: import pickle
  import numpy
  import torch
  from utils import build_knns, build_next_level, decode, density_estimation, fast_knns2spmat, knns2ordered_nbrs, l2norm, row_normalize, sparse_mx_to_indices_values
  import dgl
label_desc: Use image node_id 2 for calling the LanderDataset obj's underlying member method code with example usage: obj._build_graph(features, cluster_features, labels, density, knns) and returns: g