<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def walk(self, head=None):
 """Do a breadth-first walk of the graph, yielding on each node, starting at `head`."""

        head = head or self._root_node

        queue = []
        queue.insert(0, head)

        while queue:
            node = queue.pop()

            yield node.num, node.previous, node.siblings

            for child in node.siblings:
                if child in self._graph:
                    queue.insert(0, self._graph[child])