GUI Minimum Spanning Tree in Prim's Algorithm

0 Adeline Faye Lompon · March 20, 2015
Hello can you help me how to make this program a GUI
I really need you help please i need your advice or suggestion how to make it as a GUI
It would be helpful if you modify something in the code
Thanks



import java.util.InputMismatchException;
import java.util.Scanner;





public class Graph  {
    
    
    private boolean unsettled[];
    private boolean settled[];
    private int numberofvertices;
    private int adjacencyMatrix[][];
    private int key[];
    public static final int INFINITE = 999;
    private int parent[];
    private String[] cities;
    
    
    public Graph(){
      
    
        
        int adjacency_matrix[][];
        int number_of_vertices;
        Scanner scan = new Scanner(System.in);
        Scanner city_scanner = new Scanner(System.in);
        
        
        try {
            
            
            System.out.println("Enter the number of vertices");
            number_of_vertices = scan.nextInt();
            adjacency_matrix = new int[number_of_vertices + 1][number_of_vertices + 1];

            cities = new String[number_of_vertices];

            int n = 0;
            while (n != number_of_vertices) {
                
                System.out.println("Enter City # " + (n + 1) + ":");
                cities[n] = city_scanner.next();
                n++;
            }
            
            System.out.println("Enter the Kilometers Matrix for the graph");
            for (int i = 1; i

Post a Reply

Replies

Oldest  Newest  Rating
0 Branislav Lazic · March 20, 2015
We don't even have an idea what you want to achieve.
  • 1

Java / Android Development

107,215 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator