<｜begin▁of▁sentence｜>### Instruction:
Given a degree sequence [3, 3, 2, 2, 1], can you determine if it corresponds to a simple graph using the Havel-Hakimi algorithm?
### Response:
import networkx as nx

# Given a degree sequence
deg_sequence = [3, 3, 2, 2, 1]

# Use the Havel-Hakimi algorithm to check if the sequence is graphical
valid = nx.is_valid_degree_sequence_havel_hakimi(deg_sequence)
print('Is the degree sequence valid?', valid)
<|EOT|>
