class 3 of ML and prim's algo