Ignore:
Timestamp:
Oct 5, 2010, 5:14:37 PM (15 years ago)
Author:
gnappo
Message:

Implementata ricorsione corretta di MQI. Aggiunto parametro a linea di comando per la bisezione casuale.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/weka/clusterers/forMetisMQI/MQI.java

    r21 r22  
    8282        static private DirectedGraph<Node, Edge> prepareDirectedGraph(
    8383                        Bisection bisection, Node source, Node sink, boolean forConductance) {
    84                 Subgraph A = bisection.getLargerSubgraph();
    85                 Subgraph B = bisection.getSmallerSubgraph();
     84                Subgraph B = bisection.getLargerSubgraph();
     85                Subgraph A = bisection.getSmallerSubgraph();
    8686                int a = 0;
    8787                if (!forConductance)
    8888                        a = A.getVertexCount();
    8989                else {
    90                         a = Math.min(B.totalDegree(),A.totalDegree());
     90//                      a = Math.min(B.totalDegree(),A.totalDegree());
     91                        a = A.totalDegree();
    9192                }
    9293                int c = bisection.edgeCut() / 2;
     
    140141                        Node u = nodes.next();
    141142                        if(forConductance)
    142                                 //FIXME: CONTROLLAMI
    143143                                g.addEdge(new Edge(Integer.toString(id), 1, c * bisection.getGraph().degree(u)), u, sink);
    144144                        else
     
    161161                boolean finished = false;
    162162                Bisection bisection = partition;
    163                 Set<Node> cluster = new HashSet<Node>(partition.getLargerSubgraph()
     163                Set<Node> cluster = new HashSet<Node>(partition.getSmallerSubgraph()
    164164                                .createInducedSubgraph().getVertices());
     165//              System.out.println("IMPROVING SUBGRAPH: " + cluster);
    165166                int maxFlowThreshold = Integer.MAX_VALUE;
    166167                while (!finished) {
     
    192193                                                * bisection.edgeCut() / 2;
    193194                        else {
    194                                 maxFlowThreshold = Math.min(bisection.getLargerSubgraph().totalDegree(), bisection.getSmallerSubgraph().totalDegree());
     195//                              maxFlowThreshold = Math.min(bisection.getLargerSubgraph().totalDegree(), bisection.getSmallerSubgraph().totalDegree());
     196                                maxFlowThreshold = bisection.getSmallerSubgraph().totalDegree();
    195197                                maxFlowThreshold = maxFlowThreshold
    196198                                                * (bisection.edgeCut() / 2);
    197199                        }
    198200                        alg.evaluate();
    199                         Util.viewFlowGraph(directedGraph, edgeFlowMap);
     201//                      Util.viewFlowGraph(directedGraph, edgeFlowMap);
    200202                        System.out.println("MAX FLOW: " + alg.getMaxFlow() + " THRESHOLD: "
    201203                                        + maxFlowThreshold);
     
    207209                                bisection = new Bisection(new Subgraph(
    208210                                        bisection.getGraph(), cluster));
     211//                              System.out.println("REFINED BISECTION: " + bisection.toString());
    209212                        } else
    210213                                finished = true;
Note: See TracChangeset for help on using the changeset viewer.