<｜begin▁of▁sentence｜>### Instruction:
Given a directed graph with node set {'A', 'B', 'C', 'D'} and edge set {('A', 'B', 2), ('A', 'C', 3), ('B', 'C', 1), ('B', 'D', 1), ('C', 'D', 4), ('D', 'A', 5)}, where tuples are (from_node, to_node, weight), calculate the PageRank of each node using a damping factor of 0.85.
### Response:
import networkx as nx

# Create a directed graph
G = nx.DiGraph()

# Add edges (directed)
G.add_edge('A', 'B', weight=2)
G.add_edge('A', 'C', weight=3)
G.add_edge('B', 'C', weight=1)
G.add_edge('B', 'D', weight=1)
G.add_edge('C', 'D', weight=4)
G.add_edge('D', 'A', weight=5)

# Compute PageRank
pagerank = nx.pagerank(G, alpha=0.85)

print(pagerank)
<|EOT|>
