Concepts3
โ๏ธAlgorithmIntermediate
SPFA (Shortest Path Faster Algorithm)
SPFA is a queue-based optimization of BellmanโFord that only relaxes edges from vertices whose distance just improved.
#spfa#bellman-ford#shortest path+12
โ๏ธAlgorithmIntermediate
Bellman-Ford Algorithm
BellmanโFord finds single-source shortest paths even when some edge weights are negative.
#bellman-ford#single-source shortest paths#negative weights+12
๐๏ธData StructureIntermediate
DSU with Weighted Edges
A DSU with weighted edges (also called a potential or difference-constraint union-find) maintains relative values between elements while still supporting near-constant-time merges and finds.
#dsu#union-find#weighted edges+11