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: Creates a BFS sampling tree as an adjacency list from head node types.
  
  Each list element is a tuple of::
  
      (node_type, [child_1, child_2, ...])
  
  where ``child_k`` is an index pointing to the child of the current node.
  
  Note that the children are ordered by edge type.
  
  Args:
      head_node_types: Node types of head nodes.
      n_hops: How many hops to sample.
  
  Returns:
      List of form ``[ (node_type, [children]), ...]``
docstr_tok: ["Creates","a","BFS","sampling","tree","as","an","adjacency","list","from","head","node","types",".","Each","list","element","is","a","tuple","of",":",":","(","node_type",",","[","child_1",",","child_2",",","...","]",")","where","``","child_k","``","is","an","index","pointing","to","the","child","of","the","current","node",".","Note","that","the","children","are","ordered","by","edge","type",".","Args",":","head_node_types",":","Node","types","of","head","nodes",".","n_hops",":","How","many","hops","to","sample",".","Returns",":","List","of","form","``","[","(","node_type",",","[","children","]",")",",","...","]","``"]
code: def type_adjacency_list(self, head_node_types, n_hops):
      """
      Creates a BFS sampling tree as an adjacency list from head node types.
  
      Each list element is a tuple of::
  
          (node_type, [child_1, child_2, ...])
  
      where ``child_k`` is an index pointing to the child of the current node.
  
      Note that the children are ordered by edge type.
  
      Args:
          head_node_types: Node types of head nodes.
          n_hops: How many hops to sample.
  
      Returns:
          List of form ``[ (node_type, [children]), ...]``
      """
      if not isinstance(head_node_types, (list, tuple)):
          raise TypeError(
              "The head node types should be a list or tuple."
          )
  
      if not isinstance(n_hops, int):
          raise TypeError("n_hops should be an integer")
  
      to_process = queue.Queue()
  
      # Add head nodes
      clist = list()
      for ii, hn in enumerate(head_node_types):
          if n_hops > 0:
              to_process.put((hn, ii, 0))
          clist.append((hn, []))
  
      while not to_process.empty():
          # Get node, node index, and level
          nt, ninx, lvl = to_process.get()
  
          # The ordered list of edge types from this node type
          ets = self.schema[nt]
  
          # Iterate over edge types (in order)
          for et in ets:
              cinx = len(clist)
              clist.append((et.n2, []))
              clist[ninx][1].append(cinx)
              if n_hops > lvl + 1:
                  to_process.put((et.n2, cinx, lvl + 1))
  
      return clist
  
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 8 for calling the GraphSchema obj's underlying member method code with example usage: obj.type_adjacency_list(head_node_types, n_hops) and returns: clist