<｜begin▁of▁sentence｜>### Instruction:
Given a graph with vertices 1, 2, 3, 4, 5 and edges [(1, 2), (1, 3), (2, 4), (3, 4), (4, 5)], can you use NetworkX to compute the shortest path lengths from a source node 1 to all other nodes and print these lengths?
### Response:
import networkx as nx

# Create a graph
G = nx.Graph()
G.add_edges_from([(1, 2), (1, 3), (2, 4), (3, 4), (4, 5)])

# Compute the shortest path lengths from source node 1 to all other nodes
path_lengths = nx.single_source_shortest_path_length(G, source=1)

# Print the shortest path lengthsor node, length in path_lengths.items():
    print(f'Shortest path length from node 1 to node {node} is {length}')
<|EOT|>
