Add a basic implementation of Prim's algorithm.