mst generator. Generates a list of edges