<｜begin▁of▁sentence｜>### Instruction:
Given a degree sequence [4, 3, 3, 3, 2, 2, 1], how can you create a simple graph using the Havel-Hakimi algorithm and list its nodes and edges?
### Response:
import networkx as nx

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

# Create a graph using the Havel-Hakimi algorithm
H = nx.havel_hakimi_graph(deg_sequence)

# Print nodes and edges of the graph
print('Nodes:', H.nodes())
print('Edges:', H.edges())
<|EOT|>
