

Example:



/* ========================================== Edges is stored as Node of a linked list ========================================== */ public class Edge { int NodeID; // The neighbor node Node next; // Link variable } 
/* ============================================================= The graph is an array of Edge (Edge[i] = all edges of node i) ============================================================= */ public class Graph { public Edge[] graph; // Array of Edges } 



/* ======================================= The graph class using adjacency matrix ======================================= */ public class Graph { int[][] M; // M[i][j] > 0 <==> edge (i,j) exists .... (other methods still need to be added) } 



