<｜begin▁of▁sentence｜>### Instruction:
Given a directed acyclic graph (DAG) with edges [(1, 2), (2, 3), (1, 3), (3, 4), (2, 4)], can you compute the transitive reduction using NetworkX and ensure the original node/edge data is maintained in the resulting graph?
### Response:
import networkx as nx

# Create a directed acyclic graph (DAG)
DG = nx.DiGraph([(1, 2), (2, 3), (1, 3), (3, 4), (2, 4)])

# Perform transitive reduction
TR = nx.transitive_reduction(DG)

# Output the edges of the transitive reduction
print(list(TR.edges()))

# To maintain the original node/edge data
TR.add_nodes_from(DG.nodes(data=True))
TR.add_edges_from((u, v, DG.edges[u, v]) for u, v in TR.edges())
print(list(TR.edges(data=True)))
<|EOT|>
