<｜begin▁of▁sentence｜>### Instruction:
Suppose you have a directed graph with edges [(0, 1), (0, 2), (1, 3), (1, 4), (2, 5), (2, 6), (3, 7), (4, 8)]. How can you generate an iterator of successors in a breadth-first search from node 0, limiting the depth of the search to 2 levels?
### Response:
import networkx as nx

# Create a directed graph
G = nx.DiGraph()

# Add edges
G.add_edges_from([(0, 1), (0, 2), (1, 3), (1, 4), (2, 5), (2, 6), (3, 7), (4, 8)])

# Use bfs_successors starting from node 0 with a depth limit of 2
successors = dict(nx.bfs_successors(G, source=0, depth_limit=2))
print(successors)
<|EOT|>
