Advertisement
jvidalgz

Grafo

Mar 31st, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. package grafo;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. /**
  6.  * Created by jaime on 31-03-2015.
  7.  */
  8. public class Grafo<T> {
  9.  
  10.     public ArrayList<Vertice> vertices;
  11.  
  12.     public Grafo() {
  13.         vertices = new ArrayList<Vertice>();
  14.  
  15.     }
  16.  
  17.     public void insertarVertice(Vertice<T> v) {
  18.         vertices.add(v);
  19.     }
  20.     @Override
  21.     public String toString(){
  22.         String cadena ="";
  23.         for (int i = 0; i <vertices.size() ; i++) {
  24.  
  25.             cadena += "\n" + vertices.get(i).toString();
  26.  
  27.         }
  28.         return cadena;
  29.     }
  30.  
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement