Network Delay Time
Compute the minimum time for a signal to reach all graph nodes using Dijkstra single-source shortest path.
01The problem
You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed edges times[i] = [u, v, w], where u is the source node, v is the target node, and w is the time it takes for a signal to travel from source to target.
We will send a signal from a given node k. Return the minimum time it takes for all the n nodes to receive the signal. If it is impossible for all n nodes to receive the signal, return -1.
Loading the rest of the lesson…