Algorithm Atlas

Preparing your learning space

Loading your lessons and saved progress.

Find the City With the Smallest Number of Neighbors at a Threshold Distance: step-by-step visual explanation

Learn the Find the City With the Smallest Number of Neighbors at a Threshold Distance problem with a step-by-step DSA animation. Follow the Bellman-Ford solution with synced C#, Python, and Java code.

Bellman-Ford pattern

After V−1 passes every simple shortest path is represented. A further improvement proves a negative cycle.

Difficulty: Medium · Approach: Visible frontier and visited order

This is a public lesson preview. Sign in with a Lifetime Pass to open the protected animation, solution, and code.

More Bellman-Ford lessons