Prim Matrix Rebuild