<｜begin▁of▁sentence｜>### Instruction:
Given the number of nodes (5) and edges (4) for a random graph, can you generate a random graph using the NetworkX function gnm_random_graph and display its nodes and edges?
### Response:
import networkx as nx

# Define the number of nodes and edges
n = 5
m = 4

# Create a G_{n,m} random graph
G = nx.gnm_random_graph(n, m, seed=42)

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