It’s a

In the following discussion, let the distance from each node not in the tree to the tree be the edge of minimal weight between that node and some node in the tree. If there is no such edge, assume the distance is infinity (this shouldn’t happen).

The algorithm (greedily) builds the minimal spanning tree by iteratively adding nodes into a working tree:

Start with only node A in the tree.

Find the closest node to the tree, and add it.

Repeat until there are

That all the nodes are visited with minimum value .

**greedy**style algorithm and it’s guaranteed to produce a correct result.In the following discussion, let the distance from each node not in the tree to the tree be the edge of minimal weight between that node and some node in the tree. If there is no such edge, assume the distance is infinity (this shouldn’t happen).

The algorithm (greedily) builds the minimal spanning tree by iteratively adding nodes into a working tree:

- Start with a tree which contains only one node.
- Identify a node (outside the tree) which is closest to the tree and add the minimum weight edge from that node to some node in the tree and incorporate the additional node as a part of the tree.
- If there are less then
*n – 1*edges in the tree, go to**2**

Start with only node A in the tree.

Find the closest node to the tree, and add it.

Repeat until there are

*n – 1*edges in the tree.That all the nodes are visited with minimum value .

Facebook Blogger Plugin by

**Pradeesh**|**Techie Touch**