Skip to main content

Posts

Showing posts from September, 2021

Discrete Mathematical Structures

  UNIT-3 Prim's Algorithm Prim's Algorithm is used to find the minimum spanning tree from a graph.  Spanning tree : A tree T is said to be spanning tree if  it contains all the vertices and do not form any cycles. i.e.  without forming any cycles a tree can be constructed and must have all the vertices.  Prim's algorithm finds the subset of edges that includes every vertex of the graph such that the sum of the weights of the edges can be minimized. Prim's algorithm starts with the single node and explore all the adjacent nodes with all the connecting edges at every step. The edges with the minimal weights causing no cycles in the graph got selected. The algorithm is given as follows. Algorithm Step 1:  Select a starting vertex Step 2:  Repeat Steps 3 and 4 until there are fringe vertices Step 3:  Select an edge e connecting the tree vertex and fringe vertex that has minimum weight Step 4:  Add the selected edge and the vertex t