HW-Prim's alg