Minimum Spanning Trees (MST)

Let's imagine an undirected graph with weighted edges.


From this graph, the spanning tree wil be a tree that maps all the vertices. In other words, the tree seen above will be G = (V, E) = (4, 5) and the spanning tree must be at least S = (4, 3). Let us visualize us this down below.


Here we will have S = (4, 3) marked with green, which will be our spanning tree. As we can see, it covers all the vertices in the tree. However, it doesn't cover all the vertices in regards to the weighted edges. This S tree will have the sum of 4 + 5 + 2 = 11.

Now when it comes to minimal spanning trees, we have to care about the weighted edges in the graph. Let's find the minimal spanning tree of the G graph above.

Let's call this subgraph for S2 = (4, 3). In this subgraph we will see that the sum will be equal to 4 + 1 +2 = 7 and that it covers all the vertices. Since it has the smallest sum out of all the spanning trees you can make over graph G, it will be the minimal spanning tree. A little notice here is that there could be many spanning tree's and minimal spanning tree's in a graph, which are often named subgraphs of the graph.

Comments

Popular posts from this blog

Vigenère cipher encryption with C++