<｜begin▁of▁sentence｜>### Instruction:
Given a directed graph with edges (1, 2), (2, 3), (3, 4), (2, 4), which nodes are reachable from node 2?
### Response:
import networkx as nx

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

# Add edges to the graph (nodes are added automatically)
DG.add_edges_from([(1, 2), (2, 3), (3, 4), (2, 4)])

# Use the descendants function to get all nodes reachable from node 2
reachable_from_2 = nx.descendants(DG, 2)

# Print the set of descendants
print(reachable_from_2)
<|EOT|>
