prim algorithm and tests
performance optimization