You are on page 1of 1

package pkg200760107005;

//import java.util.ArrayList;
import java.util.Scanner;

public class Main {

public static void main(String[] args) {

int graph[][] = new int[][] { { 999, 6, 1, 5, 999, 999 },


{ 6, 999, 5, 999, 3, 999 },
{ 1, 5, 999, 5, 6, 4 },
{ 5, 999, 5, 999, 999, 2 },
{ 999, 3, 6, 999, 999, 6 },
{ 999, 999, 4, 2, 6, 999}};

int[] v = new int[] {0,0,0,0,0,0};


Scanner input = new Scanner(System.in);
System.out.println("Enter Which node to you start....");
int a = input.nextInt();
v[a] = 1;
int x,y;
int count=0;
while(count<=5)
{
for(int i=0;i<6;i++){
int min=999;
if(v[i]==1){
for(int j=0;j<6;j++){
if(graph[i][j]<min)
{
min=graph[i][j];
x=i;
y=j;
}
}

}
}
if()
{
count++;
}
graph[x][y]=graph[y][x]=999;
}
}

You might also like