


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



package main; public class Main { public static void main(String[] args) { Graph graph = new Graph(5); graph.addNode(new Node('A')); graph.addNode(new Node('B')); graph.addNode(new Node('C')); graph.addNode(new Node('D')); graph.addNode(new Node('E')); graph.addEdge(0,1); graph.addEdge(0,4); graph.addEdge(1,2); graph.addEdge(2,3); graph.addEdge(2,4); graph.print(); System.out.println(graph.checkEdge(0,1)); System.out.println(graph.checkEdge(0,2)); }
package main; import java.util.ArrayList; public class Graph { ArrayList
System.out.println(); } } }
package main; public class Node { char data; Node (char data){ this.data=data; }