VFlash: Fast, Accurate Visual Planning via Flash Primitive Decoding
u_Unrolled
DSA for AI/ML · Module 11: Graphs

Lesson 11.10 of 16 in this module Unrolled Pro

Network Delay Time

A signal starts at one node of a weighted directed network; how long until every node has received it? That's the largest shortest-path distance from the source. From Bellman-Ford, which relaxes every edge V − 1 times (O(V · E)), to Dijkstra's algorithm with a min-heap, which settles nodes in order of distance (O(E log V)), with a proof of why the greedy choice is safe. Then negative weights, all-pairs distances, a single target with early exit, and latency through a mesh of model-serving services.

about 10 min 3 Python examples 2 quick checks

Problem. A network has n nodes and directed edges (u, v, w): a signal from u reaches v after w time units (w ≥ 0). A signal is sent from node k. Return the time until all nodes have received it, or −1 if some node never does.

text
times = [(2, 1, 1), (2, 3, 1), (3, 4, 1)],  n = 4,  k = 2   →   2
times = [(1, 2, 1)],                         n = 2,  k = 2   →   −1   (node 1 is unreachable)

Each node receives the signal at its shortest-path distance from k; the answer is the largest of these. With weights, BFS levels no longer equal distances (a path of three cheap edges can beat one expensive edge), so we need a weighted shortest-path algorithm.

ML context. Model serving is a graph of services (gateway, retriever, reranker, model shards) with latencies on each hop; the time until a request can reach every shard, or the fastest route to one service, is a shortest-path question. Routing inference requests across regions, choosing the cheapest chain of conversions between data formats, and planning in RL environments with costs all run Dijkstra or a variant.


1. Step 1: Clarify

That's the preview. Modules 00–01 are free; this lesson is part of Unrolled Pro.
Staff AI & Pro Tier Lesson

Unlock "Network Delay Time"

The foundations are free forever. Unrolled Pro unlocks the complete lesson, production architectures, and 55 battle-tested ML system design case studies.

Everything included with Pro:
All 234+ Deep-Dive Lessons across transformer internals, inference, RAG & agents
55 Staff-Level ML & System Design Case Studies with mathematical capacity estimates
AI Engineer Sheet & Exercises with worked solutions, self-checks, and code
100 Landmark Research Papers guided walkthroughs & progress tracking
14-Day Money-Back Guarantee — 100% full refund if you aren't satisfied
View Plans & Unlock All Lessons

From ₹167/mo (~$2/mo) · Cancel anytime · Instant activation

100% Risk-Free: 14-day no-questions-asked money-back guarantee