private static void printSummary(Set<Graph> graphs) throws IOException {
    PrintWriter out = new PrintWriter(new FileWriter(new File(RESULT_DIR + SP
        + "ComponentSummary.txt")));

    out.println("Total graphs: " + graphs.size());
    TreeMap<Integer, ArrayList<Graph>> sizes = new TreeMap<Integer, ArrayList<Graph>>();
    for (Graph graph : graphs) {
      int size = graph.size();
      if (!sizes.containsKey(size)) {
        sizes.put(size, new ArrayList<Graph>());
      }
      sizes.get(size).add(graph);
    }

    for (Entry<Integer, ArrayList<Graph>> entry : sizes.entrySet()) {
      int size = entry.getKey();
      ArrayList<Graph> sizegraphs = entry.getValue();
      out.format("Size %d: %d%n", size, sizegraphs.size());
      StringBuffer buf = new StringBuffer();
      for (int x = 0; x < sizegraphs.size(); x++) {
        if (x != 0) {
          buf.append(" ");
        }
        buf.append(sizegraphs.get(x).getName());
      }
      out.println(buf.toString());
    }

    out.flush();
    out.close();
  }