<｜begin▁of▁sentence｜>### Instruction:
Given a degree sequence [3, 2, 2, 2, 1], how can you determine if this sequence can be represented as a degree sequence of a simple graph using NetworkX's is_graphical function?
### Response:
import networkx as nx

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

# Check if the sequence is graphical using default method (Erdős-Gallai)
print(nx.is_graphical(sequence))

# Check using Havel-Hakimi algorithm
print(nx.is_graphical(sequence, method='hh'))
<|EOT|>
