class_docstr: Class to encapsulate the schema information for a heterogeneous graph.
  
  Typically this should be created from a StellarGraph object, using the
  :func:`~stellargraph.core.graph.create_graph_schema` method.
class_docstr_tok: ["Class","to","encapsulate","the","schema","information","for","a","heterogeneous","graph",".","Typically","this","should","be","created","from","a","StellarGraph","object",",","using","the",":","func",":","`","~stellargraph.core.graph.create_graph_schema","`","method","."]
docstr: Returns a sampling tree for the specified head node types
  for neighbours up to n_hops away.
  A unique ID is created for each sampling node.
  
  Args:
      head_node_types: An iterable of the types of the head nodes
      n_hops: The number of hops away
  
  Returns:
      A list of the form [(type_adjacency_index, node_type, [children]), ...]
      where children are (type_adjacency_index, node_type, [children])
docstr_tok: ["Returns","a","sampling","tree","for","the","specified","head","node","types","for","neighbours","up","to","n_hops","away",".","A","unique","ID","is","created","for","each","sampling","node",".","Args",":","head_node_types",":","An","iterable","of","the","types","of","the","head","nodes","n_hops",":","The","number","of","hops","away","Returns",":","A","list","of","the","form","[","(","type_adjacency_index",",","node_type",",","[","children","]",")",",","...","]","where","children","are","(","type_adjacency_index",",","node_type",",","[","children","]",")"]
code: def sampling_tree(self, head_node_types, n_hops):
      """
      Returns a sampling tree for the specified head node types
      for neighbours up to n_hops away.
      A unique ID is created for each sampling node.
  
      Args:
          head_node_types: An iterable of the types of the head nodes
          n_hops: The number of hops away
  
      Returns:
          A list of the form [(type_adjacency_index, node_type, [children]), ...]
          where children are (type_adjacency_index, node_type, [children])
  
      """
      adjacency_list = self.type_adjacency_list(head_node_types, n_hops)
  
      def pack_tree(nodes, level):
          return [
              (
                  n,
                  adjacency_list[n][0],
                  pack_tree(adjacency_list[n][1], level + 1),
              )
              for n in nodes
          ]
  
      # The first k nodes will be the head nodes in the adjacency list
      return adjacency_list, pack_tree(range(len(head_node_types)), 0)
  
file_path: stellargraph/stellargraph/core/schema.py
imports: import queue
  import warnings
  from collections.__init__ import namedtuple
  from ..core.utils import is_real_iterable
label_desc: Use image node_id 6 for calling the GraphSchema obj's underlying member method code with example usage: obj.sampling_tree(head_node_types, n_hops) and returns: adjacency_list,  pack_tree, unknown