Single Source Shortest Path

Find shortest paths from a source to all nodes

Computes shortest paths (minimum hop count) from a source node to all reachable nodes using BFS.

What It Computes

For each reachable node:

  • Distance (hops) from source
  • Optional: actual path

When to Use It

  • Accessibility: What can source reach?
  • Distance analysis: How far are nodes from source?
  • Network diameter: Farthest reachable node

Parameters

ParameterTypeDescription
sourcenode/strStarting node
cutoffintMax hops (optional)

Performance

Time: O(V + E)
Very fast - BFS is optimal

Example

Use Cases

Service Reachability

From root service, what's reachable?

Network Diameter

Maximum distance = network diameter

Blast Radius

From failure point, how far does impact spread?

See Also