Understanding spanning trees

Before we go ahead and implement the pseudo code and the code, let's take some time to understand what spanning trees are and how we can employ them to simplify the problems as stated previously.

A spanning tree within a graph is a series of edges that can connect all the nodes without any cycles within them. By saying that, it is obvious that there can be more than one spanning tree for any given graph. In terms of our example, it makes more sense now that we want to generate the minimum spanning tree (MST), that is, the spanning tree in which the combined edge weight is the minimum.

However, how do we generate the spanning tree and make sure that it has the minimum value? The solution, although not quite obvious, is quite simple. Let's explore the approach with the pseudo code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.253.163