Implement Prims algorithm for room connections in the dungeon.