class_docstr: Breadth First Walk that generates a sampled number of paths from a starting node.
  It can be used to extract a random sub-graph starting from a set of initial nodes.
class_docstr_tok: ["Breadth","First","Walk","that","generates","a","sampled","number","of","paths","from","a","starting","node",".","It","can","be","used","to","extract","a","random","sub-graph","starting","from","a","set","of","initial","nodes","."]
docstr: Performs a sampled breadth-first walk starting from the root nodes.
  
  Args:
      nodes (list): A list of root node ids such that from each node a BFWs will be generated up to the
          given depth. The depth of each of the walks is inferred from the length of the ``n_size``
          list parameter.
      n_size (list of int): The number of neighbouring nodes to expand at each depth of the walk.
          Sampling of neighbours is always done with replacement regardless of the node degree and
          number of neighbours requested.
      n (int): Number of walks per node id.
      seed (int, optional): Random number generator seed; Default is None.
      weighted (bool, optional): If True, sample neighbours using the edge weights in the graph.
  
  Returns:
      A list of lists such that each list element is a sequence of ids corresponding to a BFW.
docstr_tok: ["Performs","a","sampled","breadth-first","walk","starting","from","the","root","nodes",".","Args",":","nodes","(","list",")",":","A","list","of","root","node","ids","such","that","from","each","node","a","BFWs","will","be","generated","up","to","the","given","depth",".","The","depth","of","each","of","the","walks","is","inferred","from","the","length","of","the","``","n_size","``","list","parameter",".","n_size","(","list","of","int",")",":","The","number","of","neighbouring","nodes","to","expand","at","each","depth","of","the","walk",".","Sampling","of","neighbours","is","always","done","with","replacement","regardless","of","the","node","degree","and","number","of","neighbours","requested",".","n","(","int",")",":","Number","of","walks","per","node","id",".","seed","(","int",",","optional",")",":","Random","number","generator","seed",";","Default","is","None",".","weighted","(","bool",",","optional",")",":","If","True",",","sample","neighbours","using","the","edge","weights","in","the","graph",".","Returns",":","A","list","of","lists","such","that","each","list","element","is","a","sequence","of","ids","corresponding","to","a","BFW","."]
code: def run(self, nodes, n_size, n=1, seed=None, weighted=False):
      """
      Performs a sampled breadth-first walk starting from the root nodes.
  
      Args:
          nodes (list): A list of root node ids such that from each node a BFWs will be generated up to the
              given depth. The depth of each of the walks is inferred from the length of the ``n_size``
              list parameter.
          n_size (list of int): The number of neighbouring nodes to expand at each depth of the walk.
              Sampling of neighbours is always done with replacement regardless of the node degree and
              number of neighbours requested.
          n (int): Number of walks per node id.
          seed (int, optional): Random number generator seed; Default is None.
          weighted (bool, optional): If True, sample neighbours using the edge weights in the graph.
  
      Returns:
          A list of lists such that each list element is a sequence of ids corresponding to a BFW.
      """
      self._check_sizes(n_size)
      self._check_common_parameters(nodes, n, len(n_size), seed)
      py_and_np_rs = self._get_random_state(seed)
  
      walks = []
      max_hops = len(n_size)  # depth of search
  
      for node in nodes:  # iterate over root nodes
          for _ in range(
              n
          ):  # do n bounded breadth first walks from each root node
              q = deque()  # the queue of neighbours
              walk = list()  # the list of nodes in the subgraph of node
              # extend() needs iterable as parameter; we use list of tuples (node id, depth)
              q.append((node, 0))
  
              while len(q) > 0:
                  # remove the top element in the queue
                  # index 0 pop the item from the front of the list
                  cur_node, cur_depth = q.popleft()
                  depth = (
                      cur_depth + 1
                  )  # the depth of the neighbouring nodes
                  walk.append(cur_node)  # add to the walk
  
                  # consider the subgraph up to and including max_hops from root node
                  if depth > max_hops:
                      continue
  
                  neighbours = self._sample_neighbours_untyped(
                      self.graph.neighbor_arrays,
                      py_and_np_rs,
                      cur_node,
                      n_size[cur_depth],
                      weighted,
                  )
  
                  # add them to the back of the queue
                  q.extend(
                      (sampled_node, depth)
                      for sampled_node in neighbours
                  )
  
              # finished i-th walk from node so add it to the list of walks as a list
              walks.append(walk)
  
      return walks
  
imports: import numpy
  import warnings
  from collections import defaultdict, deque
  from scipy import stats
  from scipy.special import softmax
  from ..core.schema import GraphSchema
  from ..core.graph import StellarGraph
  from ..core.utils import is_real_iterable
  from ..core.validation import require_integer_in_range, comma_sep
  from ..random import random_state
  from abc import ABC, abstractmethod
label_desc: Use image node_id 1 for calling the SampledBreadthFirstWalk obj's underlying member method code with example usage: obj.run(nodes, n_size, n, seed, weighted) and returns: walks