/**
   * Clusters the graph by edge betweenness clusterer.
   *
   * @param vg the prefuse visual graph
   * @param numEdgesToRemove
   * @return Set<Set<Long>> the clustered node set
   */
  public static Set<Set<String>> clusterGraph(VisualGraph vg, int numEdgesToRemove) {
    edu.uci.ics.jung.graph.Graph<String, String> graph = convertJungGraph(vg);
    System.out.println("graph == " + graph);

    EdgeBetweennessClusterer<String, String> clusterer =
        new EdgeBetweennessClusterer<String, String>(numEdgesToRemove);
    Set<Set<String>> clusterSet = clusterer.transform(graph);
    // List<String> edges = clusterer.getEdgesRemoved();

    return clusterSet;
  }
 private int grivanNewman(Graph<Node, Edge> graph, int numEdgesToRemove) {
   EdgeBetweennessClusterer<Node, Edge> algorithm =
       new EdgeBetweennessClusterer<Node, Edge>(numEdgesToRemove);
   int groupCounter = 0;
   for (Set<Node> set : algorithm.transform(graph)) {
     for (Node n : set) {
       n.setGroup(String.valueOf(groupCounter));
     }
     ++groupCounter;
   }
   return groupCounter;
 }