Groups
Category
Level
A graph models relationships between items using vertices (nodes) and edges (links).
SPFA is a queue-based optimization of BellmanโFord that only relaxes edges from vertices whose distance just improved.
Prim's algorithm builds a Minimum Spanning Tree (MST) by growing a tree from an arbitrary start vertex, always adding the lightest edge that connects the tree to a new vertex.
Johnson's Algorithm computes all-pairs shortest paths on sparse graphs by first removing negative edges via reweighting, then running Dijkstra from every vertex.