// cycles.java - mjd@cs.auckland.ac.nz import java.io.*; import graphs.*; public class cycles { public static void main(String argv[]) { try { BufferedReader input = new BufferedReader(new FileReader(argv[0])); while(true) { Graph G = new Graph(input); int n=G.order(); if ( n == 0 ) break; System.out.print(G.toStringAdjLists()); if ( GraphAlgs.isAcyclic(G) ) // if ( GraphAlgs.isAcyclic(new uGraph(G) ) ) { System.out.print("Graph is acyclic, "); } else { System.out.print("Graph is not acyclic, "); } System.out.print("has underlying girth " + GraphAlgs.girth(G)); if ( GraphAlgs.isBipartite(G) ) { System.out.println(", and is 2-colorable."); } else { System.out.println(", and is not 2-colorable."); } } } catch ( Exception e ) { System.err.println("Exception: "+e); } } // main } // class cycles