Skip to main content

Module prim

Module prim 

Source
Expand description

Prim’s MST algorithm with binary heap.

Functions§

prim_mst
Run Prim’s MST starting from source. Returns the list of MST edges (u, v, w). Assumes graph is undirected and connected. Negative weights are allowed for MST.