![prim algorithm prim algorithm](https://i.ytimg.com/vi/hHTzliXHB2M/maxresdefault.jpg)
However, for graphs that are sufficiently dense, Prim's algorithm can be made to run in linear time, meeting or improving the time bounds for other algorithms. In terms of their asymptotic time complexity, these three algorithms are equally fast for sparse graphs, but slower than other more sophisticated algorithms. However, running Prim's algorithm separately for each connected component of the graph, it can also be used to find the minimum spanning forest. Prims algorithm is a greedy algorithm that finds a minimum spanning tree for a connected weighted undirected graph.It finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized.This algorithm is directly based on the MST( minimum spanning tree) property. These algorithms find the minimum spanning forest in a possibly disconnected graph in contrast, the most basic form of Prim's algorithm only finds minimum spanning trees in connected graphs. Or the DJP algorithm.Other well-known algorithms for this problem include Kruskal's algorithm and Borůvka's algorithm. Therefore, it is also sometimes called the Jarník's algorithm, Prim–Jarník algorithm, Prim–Dijkstra algorithm
![prim algorithm prim algorithm](http://3.bp.blogspot.com/-1UyyWJ0AeKQ/TksE3Ev5DrI/AAAAAAAAAKc/tFT6PAO88U4/w1200-h630-p-k-no-nu/MinSpanningTree1.jpg)
The algorithm was developed in 1930 by Czech mathematician Vojtěch Jarník and later rediscovered and republished by computer scientists Robert C. The algorithm operates by building this tree one vertex at a time, from an arbitrary starting vertex, at each step adding the cheapest possible connection from the tree to another vertex. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized. In computer science, Prim's (also known as Jarník's) algorithm is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph. Wikipedia (0.00 / 0 votes) Rate this definition: