This is a code to find all the possible spanning trees of a given graph in increasing order of cost. This can be done by using either the Prim's or Kruskal's method. Here I have used the Prim's method to implement it. The code finds the spanning trees and displays them on the screen.
This is an implementation of the algorithm proposed by Kenneth Sorensen and Gerrit K.Janssens https://www.researchgate.net/publication/249927162_An_algorithm_to_generate_all_spanning_trees_of_a_graph_in_order_of_increasing_cost