
Bellman-Ford: relaxing all edges of doubt...

Bellman-Ford: relaxing all edges of doubt...
BFS, DFS, shortest paths, and connectivity in graph structures
Given an undirected unweighted graph with n nodes and edges, find shortest path length from source to target. Return -1 if unreachable.
Given a directed graph, determine if it contains a cycle.
Given n tasks and prerequisites [a,b] (b before a), return valid completion order. Empty array if impossible (cycle).
Given n nodes and edges, determine if graph is fully connected using Union-Find.
Given weighted directed graph, find shortest distances from source to all nodes. Return -1 for unreachable.
Given 2D grid of "1"s (land) and "0"s (water), count islands (4-directionally connected land).
Determine if undirected graph can be 2-colored with no same-color adjacent nodes.
Determine if graph can be colored with at most k colors such that no adjacent nodes share color.
Master the fundamental pattern. Each problem teaches you when and how to apply this technique.