<｜begin▁of▁sentence｜>### Instruction:
Imagine you're helping a group of young adventurers on a journey through the wilderness, and they've come across a series of checkpoints. They've labeled each checkpoint with a number and have noted the difficulty of the path between each checkpoint. Their journey is marked by checkpoints 0 through 4, and they've shared the following details with you:

- From checkpoint 0 to checkpoint 1, the path difficulty is rated 2.
- The stretch from checkpoint 1 to checkpoint 2 has a difficulty of 1.
- Continuing, the path from checkpoint 2 to checkpoint 3 also has a difficulty of 1.
- And lastly, the trail leading from checkpoint 3 to checkpoint 4 is the most challenging with a difficulty rating of 4.

They need to figure out the easiest paths to take from their current location at checkpoint 0 to all other checkpoints so they can conserve their energy for the adventures ahead. Can you show them how to use the map of their journey, which is essentially a weighted graph, to determine the easiest route from checkpoint 0 using a tool or method from NetworkX?
### Response:
import networkx as nx

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

# Use Dijsktra's algorithm to find the shortest path lengths from source node 0
distances = nx.single_source_dijkstra_path_length(G, source=0, weight='weight')

# Print the shortest path length to each node
for node, length in distances.items():
    print(f'Shortest path length from node 0 to node {node} is {length}')
<|EOT|>
