Prim's Algorithm

The following data structures are used:

F is a set of edges, initially empty
V is a set of vertices containing all the vertices in the graph
Y is a set of vertices, initially containing only one vertex from the graph

while (problem is not solved)
{
    select a vertex from V - Y (this ensures that cycles are not created) such that the edge from Y to that vertex is minimum

    add vertex to Y
    add edge to F

    if (Y == V)
        problem is solved
}