<｜begin▁of▁sentence｜>### Instruction:
Given a path graph with 5 nodes created using NetworkX, can you find the shortest path from node 0 to node 4, shortest paths from node 0 to all other nodes, shortest paths to node 4 from all other nodes, and all shortest paths between each pair of nodes?
### Response:
import networkx as nx

# Create a path graph with 5 nodes
G = nx.path_graph(5)

# Compute the shortest path from node 0 to node 4
path_0_to_4 = nx.shortest_path(G, source=0, target=4)
print('Shortest path from node 0 to node 4:', path_0_to_4)

# Compute shortest path from node 0 to all other nodes
path_from_0 = nx.shortest_path(G, source=0)
print('Shortest path from node 0 to node 3:', path_from_0[3])

# Compute shortest path to node 4 from all other nodes
path_to_4 = nx.shortest_path(G, target=4)
print('Shortest path to node 4 from node 1:', path_to_4[1])

# Compute shortest paths between all pairs of nodes
all_paths = nx.shortest_path(G)
print('Shortest path from node 2 to node 4:', all_paths[2][4])
<|EOT|>
