// // COMP102 // Example 7: Simple Application of the Graph Class // // Paul E. Dunne 28/10/99 // import java.io.*; import Graph; // The Graph Class Definition. import PED_NumberIO; // Ignore this (it's my own solution to // to an irritating I/O problem. public class SimpleGraphApp { public static InputStreamReader input = new InputStreamReader(System.in); public static BufferedReader keyboardInput = new BufferedReader(input); static Graph G; static final Integer Present = new Integer(1); // Object to indcate an edge static final Integer Absent = new Integer(0); // Object to indicate no edge. // N.B. Use of wrapper. static int n; // Will contain the number // of vertices (G's order) static int edge; // public static void main(String[] args) throws IOException { System.out.println("Number of vertices in the Graph?:"); n= new Integer(keyboardInput.readLine()).intValue(); G = new Graph(n); // Set up the n-vertex Graph G.SetNonEdgeValue(Absent); // and the non-edge indicator // to be used. for (int v=1; v 0) G.SetEdge(Present,v,w); else G.SetEdge(Absent,v,w); }; System.out.println(G.toString()); // // Now compute the Complement of G // for (int v=1; v