class_docstr: A plain python object modeling a heterogeneous graph with various
  attributes (Node types in :class:`HeteroGraph` require string type).
  
  Args:
      G (:class:`networkx.classes.graph`): A NetworkX graph object which
          contains features and labels for each node type and edge type.
      **kwargs: Keyworded argument list with keys such
          as :obj:`"node_feature"`, :obj:`"node_label"` and
          corresponding attributes.
class_docstr_tok: ["A","plain","python","object","modeling","a","heterogeneous","graph","with","various","attributes","(","Node","types","in",":","class",":","`","HeteroGraph","`","require","string","type",")",".","Args",":","G","(",":","class",":","`","networkx.classes.graph","`",")",":","A","NetworkX","graph","object","which","contains","features","and","labels","for","each","node","type","and","edge","type",".","*","*","kwargs",":","Keyworded","argument","list","with","keys","such","as",":","obj",":","`","``","node_feature","''","`",",",":","obj",":","`","``","node_label","''","`","and","corresponding","attributes","."]
docstr: List of G.nodes to torch tensor node_index
  
  Only the selected nodes' node indices are extracted.
  
  Returns:
      :class:`torch.tensor`: Node indices.
docstr_tok: ["List","of","G.nodes","to","torch","tensor","node_index","Only","the","selected","nodes","'","node","indices","are","extracted",".","Returns",":",":","class",":","`","torch.tensor","`",":","Node","indices","."]
code: def _node_to_index(self, nodes):
      r"""
      List of G.nodes to torch tensor node_index
  
      Only the selected nodes' node indices are extracted.
  
      Returns:
          :class:`torch.tensor`: Node indices.
      """
      node_index = {}
      for node in nodes:
          node_type = node[-1]["node_type"]
          if node_type not in node_index:
              node_index[node_type] = []
          node_index[node_type].append(node[0])
      for node_type in node_index:
          node_index[node_type] = self._convert_to_tensor_index(
              torch.tensor(node_index[node_type], dtype=torch.long)
          )
      return node_index
  
imports: import math
  import copy
  import random
  import torch
  import networkx
  import numpy
  from deepsnap.graph import Graph
  from typing import Dict, List, Union
  import warnings
label_desc: Use image node_id 18 for calling the HeteroGraph obj's underlying member method code with example usage: obj._node_to_index(nodes) and returns: node_index