Interview Questions

Find minimum spanning tree using Prim's algorithm

A minimum spanning tree of a graph is a subgraph that connects all vertices in the graph with a minimum total weight for the edges. Each edge between the vertices has a weight corresponding to it and your goal is to connect every vertex while minimizing the total edge weight. Graphs can have more than one minimum spanning tree. Below is an example of a graph with 5 vertices and weighted edges that we will be running Prim's algorithm on.
## Example graph with edge weights

You need to be a premium member to see the rest of this question and code.

mrdaniel
published this on 11/30/15 **|**

Login to submit a comment