<｜begin▁of▁sentence｜>### Instruction:
Given a directed acyclic graph (DAG) whose edge set is [(2, 1), (3, 1)], can you stratify the graph into topological generations using NetworkX?
### Response:
import networkx as nx

# Create a directed acyclic graph (DAG)
DG = nx.DiGraph([(2, 1), (3, 1)])

# Use the topological_generations function to stratify the DAG into generations
# and print out the sorted nodes for each generation
generations = [sorted(generation) for generation in nx.topological_generations(DG)]
print(generations)
<|EOT|>
