implement Prim msTree