<｜begin▁of▁sentence｜>### Instruction:
Given a directed weighted graph with the edge set [(1, 2, 2.0), (1, 3, 1.5), (2, 4, 2.5), (3, 4, 2.0)], how can you compute the shortest weighted path from node 1 to node 4 using the dijkstra_path function in NetworkX?
### Response:
import networkx as nx

# Create a weighted graph
G = nx.DiGraph()
G.add_weighted_edges_from([(1, 2, 2.0), (1, 3, 1.5), (2, 4, 2.5), (3, 4, 2.0)])

# Calculate the shortest path from node 1 to node 4
path = nx.dijkstra_path(G, source=1, target=4, weight='weight')

print('Shortest path from node 1 to node 4:', path)
<|EOT|>
