<｜begin▁of▁sentence｜>### Instruction:
Given a weighted graph with edge set [(0, 1, 2), (1, 2, 4), (2, 3, 6), (3, 4, 8)], can you compute the shortest paths between all nodes using NetworkX?
### Response:
import networkx as nx

# Create a weighted graph
G = nx.Graph()
G.add_weighted_edges_from([(0, 1, 2), (1, 2, 4), (2, 3, 6), (3, 4, 8)])

# Compute shortest paths between all nodes
paths = dict(nx.all_pairs_dijkstra_path(G))

# Output the shortest path from node 0 to node 4
print('Shortest path from 0 to 4:', paths[0][4])
<|EOT|>
