add prim algorithm eager version implementation