<｜begin▁of▁sentence｜>### Instruction:
Given an undirected graph with weighted edges [(1, 2, 6), (1, 3, 2), (2, 3, 1), (2, 4, 7), (3, 5, 9), (4, 5, 3)], can you compute the maximum-weighted matching using NetworkX? What is the set of matched edges that gives the maximum weight?
### Response:
import networkx as nx

# Create an undirected graph
G = nx.Graph()

# Add weighted edges
edges = [(1, 2, 6), (1, 3, 2), (2, 3, 1), (2, 4, 7), (3, 5, 9), (4, 5, 3)]
G.add_weighted_edges_from(edges)

# Compute a maximum-weighted matching of the graph
matching = nx.max_weight_matching(G, maxcardinality=False, weight='weight')

# Print the sorted matching pairs (if needed)
sorted_matching = sorted(matching)
print('Maximum-weight matching:', sorted_matching)
<|EOT|>
