Advertisement
Guest User

Untitled

a guest
May 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package lab13;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. public class graf_nieskierowany
  6. {
  7.  
  8. private int V;
  9. private int E;
  10. private ArrayList<Integer>[] T;
  11.  
  12. public graf_nieskierowany(int V)
  13. {
  14. this.V=V;
  15. this.E=0;
  16.  
  17. T = new ArrayList[V];
  18.  
  19.  
  20. for (int v=0; v<V;v++)
  21. {
  22. T[v] =new ArrayList<Integer>();
  23. }
  24. }
  25.  
  26. public int V()
  27. {
  28. return V;
  29. }
  30. public int E()
  31. {
  32. return E;
  33. }
  34.  
  35.  
  36. public void dodajKrawedz(int v, int w)
  37. {
  38. E++;
  39. T[v].add(w);
  40. T[w].add(v);
  41. }
  42.  
  43. public ArrayList<Integer> sasiedzi(int v)
  44. {
  45. return T[v];
  46.  
  47. }
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement