<｜begin▁of▁sentence｜>### Instruction:
Given a path graph with 3 nodes, how can you set the betweenness centrality of each node as a node attribute using NetworkX's set_node_attributes function and then access the attribute for node 1?
### Response:
import networkx as nx

# Create a graph
G = nx.path_graph(3)

# Assign betweenness centrality as a node attribute
centrality = nx.betweenness_centrality(G)

# Use the set_node_attributes function
centrality_name = 'centrality'
nx.set_node_attributes(G, centrality, centrality_name)

# Access the node attribute for node 1
node_one_centrality = G.nodes[1][centrality_name]
print(f'Node 1 {centrality_name}:', node_one_centrality)
<|EOT|>
