<｜begin▁of▁sentence｜>### Instruction:
Given a graph with 5 vertices and edges connecting them in a line: (0, 1), (1, 2), (2, 3), (3, 4), can you calculate the betweenness centrality for each vertex using NetworkX's betweenness_centrality function and print the results?
### Response:
import networkx as nx

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

# Calculate the betweenness centrality for all nodes
betweenness_centrality = nx.betweenness_centrality(G)

# Print the betweenness centrality of each vertex
for node in G.nodes():
    print(f'Vertex {node}: Betweenness Centrality = {betweenness_centrality[node]}')
<|EOT|>
