Advertisement
Guest User

Untitled

a guest
Jun 15th, 2021
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. public class GraphShow
  2. {
  3. public static void main(String[] args) {
  4. System.out.println("==+==+== Adjacency Lists Implementation ==+==+==\n");
  5. Graph graph = new Graph(true);
  6. Node a = new Node(0, "A");
  7. Node b = new Node(1, "B");
  8. Node c = new Node(2, "C");
  9. Node d = new Node(3, "D");
  10. Node e = new Node(4, "E");
  11.  
  12. graph.addEdge(a,b);
  13. graph.addEdge(b,c);
  14. graph.addEdge(b,d);
  15. graph.addEdge(c,e);
  16. graph.addEdge(b,a);
  17.  
  18. graph.printEdges();
  19.  
  20. System.out.println(graph.hasEdge(a,b));
  21. System.out.println(graph.hasEdge(d,a));
  22. }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement