<｜begin▁of▁sentence｜>### Instruction:
Given a weighted directed graph with edges [(0, 1, 100), (1, 2, 200), (2, 3, 300), (3, 4, 400)], can we use NetworkX to compute the shortest path length and predecessors from the source node 0 with a cutoff distance of 500?
### Response:
import networkx as nx

# Create a weighted directed graph
G = nx.DiGraph()
G.add_weighted_edges_from([(0, 1, 100), (1, 2, 200), (2, 3, 300), (3, 4, 400)])

# Compute the shortest path length and predecessors
pred, dist = nx.dijkstra_predecessor_and_distance(G, source=0, cutoff=500, weight='weight')

print('Predecessors:', pred)
print('Distances:', dist)
<|EOT|>
