The second week Saturday

A transcoding 1.dijkstra algorithm to achieve a class dijkstra

public class Dijkstra {
public static void main(String[] args) {
int[][] graph=new int[][]{{0,Integer.MAX_VALUE,10,Integer.MAX_VALUE,30,100},
{Integer.MAX_VALUE,0,5,Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE},
{Integer.MAX_VALUE,Integer.MAX_VALUE,0,50,Integer.MAX_VALUE,Integer.MAX_VALUE},
{Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE,0,Integer.MAX_VALUE,10},
{Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE,20,0,60},
{Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE,0}};
int[] dis=new int[6];
boolean[] visited=new boolean[6];
visited[0]=true;
for(int i=0;i<6;i++)
dis[i]=graph[0][i];
dijkstra(graph, dis, visited);
for(int i=0;i<dis.length;i++)
System.out.print(dis[i]+" ");

2. plans to continue to look at the code tomorrow, first read and then the actual operation of their own

Reopen After some initial parameters 3. Question eclipse shutdown will not transfer, you are trying to watch the video tutorial and try it yourself

Guess you like

Origin www.cnblogs.com/pekey/p/11440290.html