How it works...
The user is prompted to specify the number of vertices. Assuming the user enters 5, the value of 5 will be assigned to variable n. The vertices will be automatically named 1, 2, 3, 4, and 5 for convenience. A startList pointer of the node type is defined and is set to NULL initially. The startList pointer will be pointing to the first node of the adjacency linked list that will be created from the graph.
Two structures are defined: one is called node and the other is called lst. The node structure is for making the adjacency list representation of the graph and the lst structure is for creating a minimum spanning tree. Two pointers, pq and tr, are defined of the lst type and are defined as NULL.
To make the adjacency linked ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access