Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

caiobm

By: a guest on Jan 23rd, 2009  |  syntax: Java  |  size: 0.89 KB  |  hits: 236  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. /*
  2.  *      Main.java 1.0
  3.  *  Application to SearchGraphAlgorithms
  4.  */
  5.  
  6. /**
  7.  *
  8.  * @author Caio Bomfim Martins
  9.  */
  10. public class Main {
  11.     public static void main(String[] args) throws java.io.IOException {          
  12.         SearchGraphAlgorithms ga = new SearchGraphAlgorithms();
  13.        
  14.         Graph<Double,Double> mg = new MatGraph("graph.txt");
  15.        
  16.         SearchGraphAlgorithms.SearchInfo so = ga.search(TypeSearchEnum.DIJKSTRA, 4, mg);  
  17.        
  18.         System.out.println("A partir do vertice 4: ");
  19.         System.out.println("Menor Caminho para o ");
  20.         for(int i = 0; i < 8; i++) {
  21.             System.out.println("Vertice " + i + " " + so.getPathFrom(i));
  22.         }
  23.        
  24.         System.out.println("\n\nMenor Distancia para o ");
  25.         for(int i = 0; i < 8; i++) {
  26.             System.out.println("Vertice " + i + " " + so.getDistFrom(i));
  27.         }
  28.     }
  29. }