<｜begin▁of▁sentence｜>### Instruction:
As a youth counselor working at a community center, a new educational program is being planned where students have to navigate through a series of challenges to reach a designated goal. To help organize these challenges, an application programming interface called networkx will be used to represent the challenges as a directed graph, and then the shortest path from the starting point to the endpoint will be calculated. This will help ensure that the students are provided the most efficient route to reach their goal.
### Response:
import networkx as nx

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

# Add edges to the graph
edge_list = [(1, 2), (2, 3), (3, 4), (2, 4)]
dg.add_edges_from(edge_list)

# Compute the shortest path
source, target = 1, 4
shortest_path = nx.shortest_path(dg, source, target)

# Format the shortest path for display
formatted_path = ' -> '.join(map(str, shortest_path))
print(f'Shortest path from {source} to {target}: {formatted_path}')
<|EOT|>
