parameters: (self)
return_statement: return bfs_sorted, path_to_root
docstring: Find shortest paths to all dependencies of self.root.
docstring_summary: Find shortest paths to all dependencies of self.root.
docstring_tokens: Find shortest paths to all dependencies of self . root .
function: def _breadth_first_traversal(self):
      """Find shortest paths to all dependencies of self.root."""
      bfs_sorted = []
      to_visit = collections.deque([self.root])
      path_to_root = object_identity.ObjectIdentityDictionary()
      path_to_root[self.root] = ()
      while to_visit:
        current_trackable = to_visit.popleft()
        if isinstance(current_trackable, tracking.NotTrackable):
          raise NotImplementedError(
              ("The object %s does not support object-based saving. File a "
               "feature request if this limitation bothers you. In the meantime, "
               "you can remove the dependency on this object and save everything "
               "else.")
              % (current_trackable,))
        bfs_sorted.append(current_trackable)
        for name, dependency in self.list_dependencies(current_trackable):
          if dependency not in path_to_root:
            path_to_root[dependency] = (
                path_to_root[current_trackable] + (
                    base.TrackableReference(name, dependency),))
            to_visit.append(dependency)
      return bfs_sorted, path_to_root
function_tokens: def _breadth_first_traversal ( self ) : bfs_sorted = [ ] to_visit = collections . deque ( [ self . root ] ) path_to_root = object_identity . ObjectIdentityDictionary ( ) path_to_root [ self . root ] = ( ) while to_visit : current_trackable = to_visit . popleft ( ) if isinstance ( current_trackable , tracking . NotTrackable ) : raise NotImplementedError ( ( "The object %s does not support object-based saving. File a " "feature request if this limitation bothers you. In the meantime, " "you can remove the dependency on this object and save everything " "else." ) % ( current_trackable , ) ) bfs_sorted . append ( current_trackable ) for name , dependency in self . list_dependencies ( current_trackable ) : if dependency not in path_to_root : path_to_root [ dependency ] = ( path_to_root [ current_trackable ] + ( base . TrackableReference ( name , dependency ) , ) ) to_visit . append ( dependency ) return bfs_sorted , path_to_root