This is a Java implementation of Prims Algorithm for finding the minimum spanning tree.
You need to specify the graph using a .txt file.
Taking an example of a very basic graph . For example , you have a graph of 3 nodes - A,B,C where all the nodes are connected to one another. And this is a undirected graph. Then you will represent the graph as follows -
undirected 3 A B C A B A C B C
The code will automatically create a Adjacency List data structure representing the given graph. If the graph is directed , then you can specify it by writing 'directed' as the first line of the text file. I am placing a sample graph.txt file in the repository for your reference.
This java code generates the minimum spanning tree for any given graph.