class_docstr: A scalable graph data structure. The SGraph data structure allows arbitrary
  dictionary attributes on vertices and edges, provides flexible vertex and
  edge query functions, and seamless transformation to and from
  :class:`~turicreate.SFrame`.
  
  There are several ways to create an SGraph. The simplest way is to make an
  empty SGraph then add vertices and edges with the :py:func:`add_vertices`
  and :py:func:`add_edges` methods. SGraphs can also be created from vertex
  and edge lists stored in :class:`~turicreate.SFrames`. Columns of these
  SFrames not used as vertex IDs are assumed to be vertex or edge attributes.
  
  Please see the `User Guide
  <https://apple.github.io/turicreate/docs/userguide/sgraph/sgraph.html>`_
  for a more detailed introduction to creating and working with SGraphs.
  
  Parameters
  ----------
  vertices : SFrame, optional
      Vertex data. Must include an ID column with the name specified by
      the `vid_field` parameter. Additional columns are treated as vertex
      attributes.
  
  edges : SFrame, optional
      Edge data. Must include source and destination ID columns as specified
      by `src_field` and `dst_field` parameters. Additional columns are treated
      as edge attributes.
  
  vid_field : str, optional
      The name of vertex ID column in the `vertices` SFrame.
  
  src_field : str, optional
      The name of source ID column in the `edges` SFrame.
  
  dst_field : str, optional
      The name of destination ID column in the `edges` SFrame.
  
  See Also
  --------
  SFrame
  
  Notes
  -----
  - SGraphs are *structurally immutable*. In the example below, the
    :func:`~add_vertices` and :func:`~add_edges` commands both return a new
    graph; the old graph gets garbage collected.
  
  Examples
  --------
  >>> from turicreate import SGraph, Vertex, Edge
  >>> g = SGraph()
  >>> verts = [Vertex(0, attr={'breed': 'labrador'}),
               Vertex(1, attr={'breed': 'labrador'}),
               Vertex(2, attr={'breed': 'vizsla'})]
  >>> g = g.add_vertices(verts)
  >>> g = g.add_edges(Edge(1, 2))
class_docstr_tok: ["A","scalable","graph","data","structure",".","The","SGraph","data","structure","allows","arbitrary","dictionary","attributes","on","vertices","and","edges",",","provides","flexible","vertex","and","edge","query","functions",",","and","seamless","transformation","to","and","from",":","class",":","`","~turicreate.SFrame","`",".","There","are","several","ways","to","create","an","SGraph",".","The","simplest","way","is","to","make","an","empty","SGraph","then","add","vertices","and","edges","with","the",":","py",":","func",":","`","add_vertices","`","and",":","py",":","func",":","`","add_edges","`","methods",".","SGraphs","can","also","be","created","from","vertex","and","edge","lists","stored","in",":","class",":","`","~turicreate.SFrames","`",".","Columns","of","these","SFrames","not","used","as","vertex","IDs","are","assumed","to","be","vertex","or","edge","attributes",".","Please","see","the","`","User","Guide","<","https",":","\/\/apple.github.io\/turicreate\/docs\/userguide\/sgraph\/sgraph.html",">","`","_","for","a","more","detailed","introduction","to","creating","and","working","with","SGraphs",".","Parameters","--","--","--","--","--","vertices",":","SFrame",",","optional","Vertex","data",".","Must","include","an","ID","column","with","the","name","specified","by","the","`","vid_field","`","parameter",".","Additional","columns","are","treated","as","vertex","attributes",".","edges",":","SFrame",",","optional","Edge","data",".","Must","include","source","and","destination","ID","columns","as","specified","by","`","src_field","`","and","`","dst_field","`","parameters",".","Additional","columns","are","treated","as","edge","attributes",".","vid_field",":","str",",","optional","The","name","of","vertex","ID","column","in","the","`","vertices","`","SFrame",".","src_field",":","str",",","optional","The","name","of","source","ID","column","in","the","`","edges","`","SFrame",".","dst_field",":","str",",","optional","The","name","of","destination","ID","column","in","the","`","edges","`","SFrame",".","See","Also","--","--","--","--","SFrame","Notes","--","--","-","-","SGraphs","are","*","structurally","immutable","*",".","In","the","example","below",",","the",":","func",":","`","~add_vertices","`","and",":","func",":","`","~add_edges","`","commands","both","return","a","new","graph",";","the","old","graph","gets","garbage","collected",".","Examples","--","--","--","--",">",">",">","from","turicreate","import","SGraph",",","Vertex",",","Edge",">",">",">","g","=","SGraph","(",")",">",">",">","verts","=","[","Vertex","(","0",",","attr=","{","'breed","'",":","'labrador","'","}",")",",","Vertex","(","1",",","attr=","{","'breed","'",":","'labrador","'","}",")",",","Vertex","(","2",",","attr=","{","'breed","'",":","'vizsla","'","}",")","]",">",">",">","g","=","g.add_vertices","(","verts",")",">",">",">","g","=","g.add_edges","(","Edge","(","1",",","2",")",")"]
docstr: Retrieve the graph neighborhood around a set of vertices, ignoring edge
  directions. Note that setting radius greater than two often results in a
  time-consuming query for a very large subgraph.
  
  Parameters
  ----------
  ids : list [int | float | str]
      List of target vertex IDs.
  
  radius : int, optional
      Radius of the neighborhood. Every vertex in the returned subgraph is
      reachable from at least one of the target vertices on a path of
      length no longer than ``radius``. Setting radius larger than 2 may
      result in a very large subgraph.
  
  full_subgraph : bool, optional
      If True, return all edges between vertices in the returned
      neighborhood. The result is also known as the subgraph induced by
      the target nodes' neighbors, or the egocentric network for the
      target nodes. If False, return only edges on paths of length <=
      ``radius`` from the target node, also known as the reachability
      graph.
  
  Returns
  -------
  out : Graph
      The subgraph with the neighborhoods around the target vertices.
  
  See Also
  --------
  get_edges, get_vertices
  
  References
  ----------
  - Marsden, P. (2002) `Egocentric and sociocentric measures of network
    centrality <http://www.sciencedirect.com/science/article/pii/S03788733
    02000163>`_.
  - `Wikipedia - Reachability <http://en.wikipedia.org/wiki/Reachability>`_
  
  Examples
  --------
  >>> sf_edge = turicreate.SFrame({'source': range(9), 'dest': range(1, 10)})
  >>> g = turicreate.SGraph()
  >>> g = g.add_edges(sf_edge, src_field='source', dst_field='dest')
  >>> subgraph = g.get_neighborhood(ids=[1, 7], radius=2,
                                    full_subgraph=True)
docstr_tok: ["Retrieve","the","graph","neighborhood","around","a","set","of","vertices",",","ignoring","edge","directions",".","Note","that","setting","radius","greater","than","two","often","results","in","a","time-consuming","query","for","a","very","large","subgraph",".","Parameters","--","--","--","--","--","ids",":","list","[","int","|","float","|","str","]","List","of","target","vertex","IDs",".","radius",":","int",",","optional","Radius","of","the","neighborhood",".","Every","vertex","in","the","returned","subgraph","is","reachable","from","at","least","one","of","the","target","vertices","on","a","path","of","length","no","longer","than","``","radius","``",".","Setting","radius","larger","than","2","may","result","in","a","very","large","subgraph",".","full_subgraph",":","bool",",","optional","If","True",",","return","all","edges","between","vertices","in","the","returned","neighborhood",".","The","result","is","also","known","as","the","subgraph","induced","by","the","target","nodes","'","neighbors",",","or","the","egocentric","network","for","the","target","nodes",".","If","False",",","return","only","edges","on","paths","of","length","<","=","``","radius","``","from","the","target","node",",","also","known","as","the","reachability","graph",".","Returns","--","--","--","-","out",":","Graph","The","subgraph","with","the","neighborhoods","around","the","target","vertices",".","See","Also","--","--","--","--","get_edges",",","get_vertices","References","--","--","--","--","--","-","Marsden",",","P.","(","2002",")","`","Egocentric","and","sociocentric","measures","of","network","centrality","<","http",":","\/\/www.sciencedirect.com\/science\/article\/pii\/S03788733","02000163",">","`","_",".","-","`","Wikipedia","-","Reachability","<","http",":","\/\/en.wikipedia.org\/wiki\/Reachability",">","`","_","Examples","--","--","--","--",">",">",">","sf_edge","=","turicreate.SFrame","(","{","'source","'",":","range","(","9",")",",","'dest","'",":","range","(","1",",","10",")","}",")",">",">",">","g","=","turicreate.SGraph","(",")",">",">",">","g","=","g.add_edges","(","sf_edge",",","src_field='source","'",",","dst_field='dest","'",")",">",">",">","subgraph","=","g.get_neighborhood","(","ids=","[","1",",","7","]",",","radius=2",",","full_subgraph=True",")"]
code: def get_neighborhood(self, ids, radius=1, full_subgraph=True):
      """
      Retrieve the graph neighborhood around a set of vertices, ignoring edge
      directions. Note that setting radius greater than two often results in a
      time-consuming query for a very large subgraph.
  
      Parameters
      ----------
      ids : list [int | float | str]
          List of target vertex IDs.
  
      radius : int, optional
          Radius of the neighborhood. Every vertex in the returned subgraph is
          reachable from at least one of the target vertices on a path of
          length no longer than ``radius``. Setting radius larger than 2 may
          result in a very large subgraph.
  
      full_subgraph : bool, optional
          If True, return all edges between vertices in the returned
          neighborhood. The result is also known as the subgraph induced by
          the target nodes' neighbors, or the egocentric network for the
          target nodes. If False, return only edges on paths of length <=
          ``radius`` from the target node, also known as the reachability
          graph.
  
      Returns
      -------
      out : Graph
          The subgraph with the neighborhoods around the target vertices.
  
      See Also
      --------
      get_edges, get_vertices
  
      References
      ----------
      - Marsden, P. (2002) `Egocentric and sociocentric measures of network
        centrality <http://www.sciencedirect.com/science/article/pii/S03788733
        02000163>`_.
      - `Wikipedia - Reachability <http://en.wikipedia.org/wiki/Reachability>`_
  
      Examples
      --------
      >>> sf_edge = turicreate.SFrame({'source': range(9), 'dest': range(1, 10)})
      >>> g = turicreate.SGraph()
      >>> g = g.add_edges(sf_edge, src_field='source', dst_field='dest')
      >>> subgraph = g.get_neighborhood(ids=[1, 7], radius=2,
                                        full_subgraph=True)
      """
  
      verts = ids
  
      ## find the vertices within radius (and the path edges)
      for i in range(radius):
          edges_out = self.get_edges(src_ids=verts)
          edges_in = self.get_edges(dst_ids=verts)
  
          verts = (
              list(edges_in["__src_id"])
              + list(edges_in["__dst_id"])
              + list(edges_out["__src_id"])
              + list(edges_out["__dst_id"])
          )
          verts = list(set(verts))
  
      ## make a new graph to return and add the vertices
      g = SGraph()
      g = g.add_vertices(self.get_vertices(verts), vid_field="__id")
  
      ## add the requested edge set
      if full_subgraph is True:
          induced_edge_out = self.get_edges(src_ids=verts)
          induced_edge_in = self.get_edges(dst_ids=verts)
          df_induced = induced_edge_out.append(induced_edge_in)
          df_induced = df_induced.groupby(df_induced.column_names(), {})
  
          verts_sa = SArray(list(verts))
          edges = df_induced.filter_by(verts_sa, "__src_id")
          edges = edges.filter_by(verts_sa, "__dst_id")
  
      else:
          path_edges = edges_out.append(edges_in)
          edges = path_edges.groupby(path_edges.column_names(), {})
  
      g = g.add_edges(edges, src_field="__src_id", dst_field="__dst_id")
      return g
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from .._connect import main
  from .sframe import SFrame
  from .sarray import SArray
  from .gframe import GFrame, VERTEX_GFRAME, EDGE_GFRAME
  from .._cython.cy_graph import UnityGraphProxy
  from .._cython.context import debug_trace
  from ..util import _is_non_string_iterable, _make_internal_url
  from .._deps import pandas
  from .._deps import HAS_PANDAS
  import inspect
  import copy
  import sys
label_desc: Use image node_id 20 for calling the SGraph obj's underlying member method code with example usage: obj.get_neighborhood(ids, radius, full_subgraph) and returns: g