<｜begin▁of▁sentence｜>### Instruction:
Given a graph with edge set [(1, 2), (1, 3), (2, 4), (2, 5)], determine if it is a forest. Then, after adding an edge (4, 1) that creates a cycle, check if the graph remains a forest using NetworkX.
### Response:
import networkx as nx

# Create a graph
G = nx.Graph()
G.add_edges_from([(1, 2), (1, 3), (2, 4), (2, 5)])

# Check if the graph is a forest
is_forest = nx.is_forest(G)
print('Is the graph a forest?', is_forest)

# Adding an edge that creates a cycle
G.add_edge(4, 1)

# Check if the graph is still a forest after adding the edge
is_forest_after = nx.is_forest(G)
print('Is the graph a forest after adding an edge?', is_forest_after)
<|EOT|>
