Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. public static EDListGraph<Character,Integer> readGraph (Scanner scan) {
  2.         int size = scan.nextInt();
  3.         EDListGraph graph = new EDListGraph(true);
  4.        
  5.         for(int i = 0; i < size; i++)
  6.             graph.insertNode(scan.next());
  7.        
  8.         int cont = 0;
  9.         while(scan.hasNextInt()) {
  10.             for(int i = 0; i < size; i++) {
  11.                 if(scan.nextInt() == 1) { //Existe enlace
  12.                     EDEdge edge = new EDEdge(cont, i);
  13.                     graph.insertEdge(edge);
  14.                 }
  15.             }
  16.             cont++;
  17.         }
  18.         return graph;
  19.        
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement