コード例 #1
0
 private int wuHuberman(Graph<Node, Edge> graph, int clusterCandidates) {
   VoltageClusterer<Node, Edge> algorithm =
       new VoltageClusterer<Node, Edge>(graph, clusterCandidates);
   int groupCounter = 0;
   for (Set<Node> set : algorithm.cluster(clusterCandidates)) {
     for (Node n : set) {
       n.setGroup(String.valueOf(groupCounter));
     }
     ++groupCounter;
   }
   return groupCounter;
 }
コード例 #2
0
 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;
 }