Changeset 26 for src/main/java/weka/clusterers/forMetisMQI/MQI.java
- Timestamp:
- Oct 9, 2010, 12:24:38 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/weka/clusterers/forMetisMQI/MQI.java
r25 r26 16 16 import weka.clusterers.forMetisMQI.graph.Node; 17 17 import weka.clusterers.forMetisMQI.graph.Subgraph; 18 import weka.clusterers.forMetisMQI.graph.UndirectedGraph; 18 19 import edu.uci.ics.jung.algorithms.flows.EdmondsKarpMaxFlow; 19 20 import edu.uci.ics.jung.graph.DirectedGraph; … … 83 84 84 85 static private DirectedGraph<Node, Edge> prepareDirectedGraph( 85 Bisection bisection, Node source, Node sink, boolean forConductance) {86 Subgraph B = bisection.getLargerSubgraph();87 Subgraph A = bisection.getSmallerSubgraph();86 Subgraph A, Node source, Node sink, boolean forConductance) { 87 Bisection bisection = new Bisection(A); 88 Subgraph B = bisection.getComplement(); 88 89 int a = 0; 89 90 if (!forConductance) … … 161 162 static public Set<Node> mqi(Bisection partition, boolean forConductance) { 162 163 // System.out.println("INITIAL BISECTION: " + partition.toString()); 164 UndirectedGraph startingGraph = partition.getGraph(); 163 165 boolean finished = false; 164 166 Bisection bisection = partition; 165 Set<Node> cluster = new HashSet<Node>(partition.get SmallerSubgraph()167 Set<Node> cluster = new HashSet<Node>(partition.getLargerSubgraph() 166 168 .createInducedSubgraph().getVertices()); 167 169 // System.out.println("IMPROVING SUBGRAPH: " + cluster); … … 170 172 Node source = new Node("$$$$S"); 171 173 Node sink = new Node("$$$$T"); 172 DirectedGraph<Node, Edge> directedGraph = prepareDirectedGraph(173 bisection, source, sink, true);174 Subgraph A = new Subgraph(startingGraph,cluster); 175 DirectedGraph<Node, Edge> directedGraph = prepareDirectedGraph(A, source, sink, true); 174 176 Transformer<Edge, Number> capTransformer = new Transformer<Edge, Number>() { 175 177 public Double transform(Edge e) { … … 191 193 192 194 if (!forConductance) 193 maxFlowThreshold = bisection.getLargerSubgraph() 194 .getVertexCount() 195 maxFlowThreshold = A.getVertexCount() 195 196 * bisection.edgeCut() / 2; 196 197 else { 197 198 // maxFlowThreshold = Math.min(bisection.getLargerSubgraph().totalDegree(), bisection.getSmallerSubgraph().totalDegree()); 198 maxFlowThreshold = bisection.getSmallerSubgraph().totalDegree();199 maxFlowThreshold = A.totalDegree(); 199 200 maxFlowThreshold = maxFlowThreshold 200 201 * (bisection.edgeCut() / 2); … … 216 217 // System.out.println("REFINED BISECTION: " + bisection.toString()); 217 218 if(Configuration.instance().getVerboseLevel() > 1) 218 GraphsFrame.instance().addPanel(Util.panelCluster(bisection.getGraph() , cluster));219 GraphsFrame.instance().addPanel(Util.panelCluster(bisection.getGraph().clone(), cluster)); 219 220 } else 220 221 finished = true;
Note: See TracChangeset
for help on using the changeset viewer.