added prims algorithm for dense graphs O(n^2)