<｜begin▁of▁sentence｜>### Instruction:
Given a directed path graph where the nodes are linearly connected from 0 to 4, can you compute the ancestors of the node at position 2 using NetworkX?
### Response:
import networkx as nx

# Create a directed graph
DG = nx.path_graph(5, create_using=nx.DiGraph)

# Get the ancestors of the node 2
ancestor_nodes = nx.ancestors(DG, 2)

print('Ancestors of node 2:', sorted(ancestor_nodes))
<|EOT|>
