Prim's

Prim's algorithm is a greedy MST algorithm. Initially, it starts at a single node. At each step, it chooses the lowest-weighted edge that is not in the MST and is adjacent to the current MST (the edges grow out from the existing tree). If the edge does not create a cycle, it is added to the MST. This process continues until all nodes in the MST have been visited/the number of edges in the MST is V - 1, where V is the number of nodes/vertices in the graph.

Look below for an example run of Prim's algorithm:

Minimum cost:
Edge queue: