<｜begin▁of▁sentence｜>### Instruction:
Given a graph with edge set [(1, 2), (1, 3), (2, 3), (2, 4), (3, 5), (4, 5)], can you determine whether a given set or dictionary represents a valid matching in the graph using the NetworkX is_matching function?
### Response:
import networkx as nx

G = nx.Graph([(1, 2), (1, 3), (2, 3), (2, 4), (3, 5), (4, 5)])

# Using a dictionary to represent the matching
matching_dict = {1: 3, 2: 4, 3: 1, 4: 2}
print(nx.is_matching(G, matching_dict))
# Output: True

# Using a set to represent the matching
matching_set = {(1, 3), (2, 4)}
print(nx.is_matching(G, matching_set))
# Output: True
<|EOT|>
