<｜begin▁of▁sentence｜>### Instruction:
Given a directed path graph with nodes ranging from 0 to 4, how can you compute the shortest path to the target node 4 starting from all nodes that can reach target?
### Response:
import networkx as nx

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

# Compute the shortest path to target 4 from all nodes that reach target
path = nx.single_target_shortest_path(G, 4)

# Print the shortest path from node 0 to 4
print(path[0])
<|EOT|>
