class_docstr: RedisGraph
class_docstr_tok: ["RedisGraph"]
docstr: Generate subgraph with nodes and edge ids.
  
  This function will generate a :code:`pgl.graph.Subgraph` object and
  copy all corresponding node and edge features. Nodes and edges will
  be reindex from 0.
  
  WARNING: ALL NODES IN EID MUST BE INCLUDED BY NODES
  
  Args:
      nodes: Node ids which will be included in the subgraph.
  
      eid: Edge ids which will be included in the subgraph.
  
  Return:
      A :code:`pgl.graph.Subgraph` object.
docstr_tok: ["Generate","subgraph","with","nodes","and","edge","ids",".","This","function","will","generate","a",":","code",":","`","pgl.graph.Subgraph","`","object","and","copy","all","corresponding","node","and","edge","features",".","Nodes","and","edges","will","be","reindex","from","0",".","WARNING",":","ALL","NODES","IN","EID","MUST","BE","INCLUDED","BY","NODES","Args",":","nodes",":","Node","ids","which","will","be","included","in","the","subgraph",".","eid",":","Edge","ids","which","will","be","included","in","the","subgraph",".","Return",":","A",":","code",":","`","pgl.graph.Subgraph","`","object","."]
code: def subgraph(self, nodes, eid, edges=None):
      """Generate subgraph with nodes and edge ids.
  
      This function will generate a :code:`pgl.graph.Subgraph` object and
      copy all corresponding node and edge features. Nodes and edges will
      be reindex from 0.
  
      WARNING: ALL NODES IN EID MUST BE INCLUDED BY NODES
  
      Args:
          nodes: Node ids which will be included in the subgraph.
  
          eid: Edge ids which will be included in the subgraph.
  
      Return:
          A :code:`pgl.graph.Subgraph` object.
      """
      reindex = {}
  
      for ind, node in enumerate(nodes):
          reindex[node] = ind
  
      if edges is None:
          edges = self.get_edges_by_id(eid)
      else:
          edges = np.array(edges, dtype="int64")
  
      sub_edges = graph_kernel.map_edges(
          np.arange(len(edges), dtype="int64"), edges, reindex
      )
  
      sub_edge_feat = {}
      for key, _, _ in self.edge_feat_info():
          sub_edge_feat[key] = self.get_edge_feat_by_id(key, eid)
  
      sub_node_feat = {}
      for key, _, _ in self.node_feat_info():
          sub_node_feat[key] = self.get_node_feat_by_id(key, nodes)
  
      subgraph = pgraph.SubGraph(
          num_nodes=len(nodes),
          edges=sub_edges,
          node_feat=sub_node_feat,
          edge_feat=sub_edge_feat,
          reindex=reindex,
      )
      return subgraph
  
imports: import pgl
  import redis
  from redis import BlockingConnectionPool, StrictRedis
  from redis._compat import b, unicode, bytes, long, basestring
  from rediscluster.nodemanager import NodeManager
  from rediscluster.crc import crc16
  from collections import OrderedDict
  import threading
  import numpy
  import time
  import json
  import pgl.graph
  import pickle
  from pgl.utils.logger import log
  import pgl.graph_kernel
label_desc: Use image node_id 17 for calling the RedisGraph obj's underlying member method code with example usage: obj.subgraph(nodes, eid, edges) and returns: subgraph