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
Minimum Spanning Tree - Prim
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.
#prim#minimum spanning tree#mst+12
βοΈAlgorithmAdvanced
Johnson's Algorithm
Johnson's Algorithm computes all-pairs shortest paths on sparse graphs by first removing negative edges via reweighting, then running Dijkstra from every vertex.
#johnson's algorithm#all pairs shortest paths#apsp+12