Creating the minimum spanning tree

To make the minimum spanning tree, we need to adjust the edges of the vertices in ascending order. The temp1 pointer is set to point at startList, that is, vertex 1. The temp2 pointer is set to point to where the edg pointer of temp1 is pointing to, that is, vertex 2.

Now, until temp2 becomes NULL, the addpqu function is invoked and vertices 1 and 2, and their weight, 1, are passed to it. In the addpqu function, a structure is created called lstNode of the lst type. The 1 and 2 vertices and their weight, 1, are assigned to the u, v, and wt members, respectively. The next pointer of lstNode is set to NULL. Additionally, a pointer, pq, is set to point to lstNode.

Following this, the temp2 pointer is set to ...

Get Practical C Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.