- Timestamp:
- Oct 5, 2010, 8:44:43 AM (14 years ago)
- Location:
- src/main/java/weka/clusterers/forMetisMQI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/weka/clusterers/forMetisMQI/GraphAlgorithms.java
r20 r21 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 partition = metis(g,sizeFinerGraph); 98 // Bisection partition = new Bisection(g); 99 99 System.out.print("Partizione iniziale: "); 100 100 System.out.print("V1: " + partition.getSubgraph().getVertexCount()); -
src/main/java/weka/clusterers/forMetisMQI/MQI.java
r20 r21 16 16 import weka.clusterers.forMetisMQI.graph.Node; 17 17 import weka.clusterers.forMetisMQI.graph.Subgraph; 18 import weka.clusterers.forMetisMQI.util.Util;19 18 import edu.uci.ics.jung.algorithms.flows.EdmondsKarpMaxFlow; 20 19 import edu.uci.ics.jung.graph.DirectedGraph; 21 20 import edu.uci.ics.jung.graph.DirectedSparseGraph; 21 import weka.clusterers.forMetisMQI.util.Util; 22 22 23 23 public class MQI { … … 88 88 a = A.getVertexCount(); 89 89 else { 90 Iterator<Node> aIterator = A.iterator(); 91 while(aIterator.hasNext()) { 92 a += bisection.getGraph().degree(aIterator.next()); 93 } 90 a = Math.min(B.totalDegree(),A.totalDegree()); 94 91 } 95 92 int c = bisection.edgeCut() / 2; … … 195 192 * bisection.edgeCut() / 2; 196 193 else { 197 Iterator<Node> aIterator = bisection.getLargerSubgraph().iterator(); 198 maxFlowThreshold = 0; 199 while(aIterator.hasNext()) 200 maxFlowThreshold += partition.getGraph().degree(aIterator.next()); 194 maxFlowThreshold = Math.min(bisection.getLargerSubgraph().totalDegree(), bisection.getSmallerSubgraph().totalDegree()); 201 195 maxFlowThreshold = maxFlowThreshold 202 196 * (bisection.edgeCut() / 2); 203 197 } 204 198 alg.evaluate(); 205 //Util.viewFlowGraph(directedGraph, edgeFlowMap);199 Util.viewFlowGraph(directedGraph, edgeFlowMap); 206 200 System.out.println("MAX FLOW: " + alg.getMaxFlow() + " THRESHOLD: " 207 201 + maxFlowThreshold);
Note: See TracChangeset
for help on using the changeset viewer.