import java.util.*; import java.io.*; // // takes a file of filenames, corresponding to problems, and measures the // problem wrt n and p // public class MeasureClique { private static void measure(String fname) throws IOException { String b = ""; Scanner sc = new Scanner(new File(fname)); while (sc.hasNext() && !b.equals("p")) b = sc.next(); sc.next(); int n = sc.nextInt(); // # vertices int m = sc.nextInt(); // # edges, maybe int count = 0; while (sc.hasNext()){ b = sc.next(); // skip "edge" int i = sc.nextInt() - 1; int j = sc.nextInt() - 1; count++; } sc.close(); System.out.println(fname +" "+ n +" "+ count +" "+ (double)count/(double)(n*(n-1)/2)); } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(new File(args[0])); while (sc.hasNext()) measure(sc.next()); sc.close(); } }