<｜begin▁of▁sentence｜>### Instruction:
Given a graph with nodes 1 to 8 and edges that connect these nodes as follows: (1, 2), (1, 5), (1, 8), (2, 3), (2, 8), (3, 4), (3, 6), (4, 5), (4, 7), (5, 6), (6, 7), and (7, 8), calculate the subgraph centrality for each node using the subgraph_centrality_exp function from the networkx library. The subgraph centrality of a node is the sum of weighted closed walks of all lengths that start and end at that node.
### Response:
import networkx as nx

# Create a graph
G = nx.Graph()

# Adding edges to the graph
G.add_edges_from(
    [
        (1, 2),
        (1, 5),
        (1, 8),
        (2, 3),
        (2, 8),
        (3, 4),
        (3, 6),
        (4, 5),
        (4, 7),
        (5, 6),
        (6, 7),
        (7, 8),
    ]
)

# Calculate the subgraph centrality for each node
subgraph_centrality = nx.subgraph_centrality_exp(G)

# Display the subgraph centrality for each node
for node in sorted(subgraph_centrality):
    print(f'{node} {subgraph_centrality[node]:0.2f}')
<|EOT|>
