How would you design algorithms for custom data routing?
Implement a minimum-cost routing algorithm for a directed network. Each link is [start, end, latency, capacity]. Route exactly units from source to sink with minimum total latency, treating parallel links between the same endpoints as distinct alternatives that can each carry at most one unit. Return -1 if routing is impossible.
Function: def route_data(nodes, links, source, sink, units):
Return an integer total latency. Nodes are integer identifiers, and all latencies and capacities are nonnegative integers.
def route_data(nodes, links, source, sink, units):