<｜begin▁of▁sentence｜>### Instruction:
Given a degree sequence [3, 2, 2, 1, 2], can you determine if it is graphical using the Erdős-Gallai algorithm?
### Response:
import networkx as nx

# Define a degree sequence
sequence = [3, 2, 2, 1, 2]

# Check if the sequence is graphical using the Erdős-Gallai algorithm
is_seq_graphical = nx.is_graphical(sequence, method='eg')

print('Is the sequence graphical?', is_seq_graphical)
<|EOT|>
