<｜begin▁of▁sentence｜>### Instruction:
In the architectural blueprint for our new software system's communication network, consider that we have a series of interconnected nodes with varying data transmission costs between them. The connections are defined as follows: (Node 0 to Node 1 has a cost of 2), (Node 1 to Node 2 has a cost of 1), (Node 1 to Node 3 has a cost of 4), (Node 3 to Node 4 has a cost of 2). We need to strategize the most efficient data routing protocol that would enable us to send information from Node 0, our primary server, to all other nodes within the network while incurring the minimum possible cost. Could you restructure this scenario to demonstrate how we might determine these optimal data pathways from our main server to each node in the network?
### Response:
import networkx as nx

# Create a weighted graph
G = nx.Graph()
G.add_weighted_edges_from([(0, 1, 2), (1, 2, 1), (1, 3, 4), (3, 4, 2)])

# Compute shortest path from source node 0 to all other nodes
path = nx.single_source_dijkstra_path(G, 0)

# Output the path to node 4
print(path[4])
<|EOT|>
