class_docstr: Data Reader for Open Graph Benchmark datasets.
docstr: Gets a graph by an integer index.
code: def get_graph_by_idx(self, idx):
      """Gets a graph by an integer index."""
      # Gather the graph information
      label = self._labels[idx]
      n_node = self._n_node[idx]
      n_edge = self._n_edge[idx]
      node_slice = slice(
          self._accumulated_n_nodes[idx],
          self._accumulated_n_nodes[idx + 1],
      )
      edge_slice = slice(
          self._accumulated_n_edges[idx],
          self._accumulated_n_edges[idx + 1],
      )
      nodes = self._nodes[node_slice]
      edges = self._edges[edge_slice]
      senders = self._senders[edge_slice]
      receivers = self._receivers[edge_slice]
      # Molecular graphs are bi directional, but the serialization only
      # stores one way so we add the missing edges.
      return jraph.GraphsTuple(
          nodes=nodes,
          edges=np.concatenate([edges, edges]),
          n_node=np.array([n_node]),
          n_edge=np.array([n_edge * 2]),
          senders=np.concatenate([senders, receivers]),
          receivers=np.concatenate([receivers, senders]),
          globals={"label": label},
      )
  
file_path: jraph/jraph/ogb_examples/data_utils.py
imports: import pathlib
  import jraph
  import numpy
  import pandas
label_desc: Use image node_id 6 for calling the DataReader obj's underlying member method code with example usage: obj.get_graph_by_idx(idx) and returns: jraph