- Timestamp:
- Oct 5, 2010, 5:14:37 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/weka/clusterers/forMetisMQI/GraphAlgorithms.java
r21 r22 80 80 * @param sizeFinerGraph 81 81 */ 82 static public Set<Set<Node>> metisMqi(UndirectedGraph g, int numberOfCluster, int sizeFinerGraph ) {82 static public Set<Set<Node>> metisMqi(UndirectedGraph g, int numberOfCluster, int sizeFinerGraph, boolean randomBisection) { 83 83 System.out.println("Vertex count: " + g.getVertexCount()); 84 84 System.out.println("Edges count: " + g.getEdgeCount()); … … 95 95 // Util.viewGraph(g); 96 96 for (int i = 0; i < numberOfCluster; i++) { 97 Bisection partition = metis(g,sizeFinerGraph); 98 // Bisection partition = new Bisection(g); 97 Bisection bisection = null; 98 if(!randomBisection) 99 bisection = metis(g,sizeFinerGraph); 100 else 101 bisection = new Bisection(g); 99 102 System.out.print("Partizione iniziale: "); 100 System.out.print("V1: " + partition.getSubgraph().getVertexCount());101 System.out.print(" V2: " + partition.getComplement().getVertexCount());102 System.out.println(" EC: " + partition.edgeCut() * 0.5);103 System.out.print("V1: " + bisection.getSubgraph().getVertexCount()); 104 System.out.print(" V2: " + bisection.getComplement().getVertexCount()); 105 System.out.println(" EC: " + bisection.edgeCut() * 0.5); 103 106 System.out.println("Conductance: " + 104 ((double) partition.edgeCut() / 2) / Math.min(partition.getSubgraph().totalDegree(),partition.getComplement().totalDegree()));105 Set<Node> cluster = MQI.mqi( partition,true);107 ((double)bisection.edgeCut() / 2) / Math.min(bisection.getSubgraph().totalDegree(),bisection.getComplement().totalDegree())); 108 Set<Node> cluster = MQI.mqi(bisection,true); 106 109 107 110 UndirectedGraph clusterGraph = new Subgraph(gclone,cluster).createInducedSubgraph(); … … 113 116 System.out.println("Conductance: " + newConductance); 114 117 115 116 if(newConductance < 1) { 117 System.out.println("CLUSTER "+ i + ": V=" + clusterGraph.getVertexCount() + ", E=" + clusterGraph.getEdgeCount()+"."); 118 clusters.add(cluster); 119 } 118 System.out.println("CLUSTER "+ i + ": V=" + clusterGraph.getVertexCount() + ", E=" + clusterGraph.getEdgeCount()+"."); 119 clusters.add(cluster); 120 120 121 121 System.out.println();
Note: See TracChangeset
for help on using the changeset viewer.