Ignore:
Timestamp:
Sep 30, 2010, 5:33:45 PM (14 years ago)
Author:
gnappo
Message:

Aggiunto metodo per stampare i grafi in formato utile per kmetis; modificato politica di azione di mqi, ora agisce sulla partizione piu` grande.

File:
1 edited

Legend:

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

    r18 r20  
    8181         */
    8282        static public Set<Set<Node>> metisMqi(UndirectedGraph g, int numberOfCluster, int sizeFinerGraph) {
    83                 System.out.println("VERTEX: " + g.getVertexCount());
    84                 System.out.println("EDGE: " + g.getEdgeCount());
     83                System.out.println("Vertex count: " + g.getVertexCount());
     84                System.out.println("Edges count: " + g.getEdgeCount());
    8585                Iterator<Node> iNodes = g.getVertices().iterator();
    8686                int degreeCounter = 0;
     
    9595//              Util.viewGraph(g);
    9696                for (int i = 0; i < numberOfCluster; i++) {
    97                         Bisection partition = metis(g,sizeFinerGraph);
    98                         System.out.println("Partizione iniziale (Metis)");
    99 //                      System.out.println("Edge-cut: " + partition.edgeCut() / 2);
     97//                      Bisection partition = metis(g,sizeFinerGraph);
     98                        Bisection partition = new Bisection(g);
     99                        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);
    100103                        System.out.println("Conductance: " +
    101104                                        ((double)partition.edgeCut() / 2) / Math.min(partition.getSubgraph().totalDegree(),partition.getComplement().totalDegree()));
     
    107110                        Bisection mqiBisection = new Bisection(new Subgraph(g,cluster));
    108111                        System.out.println("Partizione raffinata (MQI)");
    109 //                      System.out.println("Edge-cut: " + mqiBisection.edgeCut() / 2);
    110112                        double newConductance = ((double)mqiBisection.edgeCut() / 2) / Math.min(mqiBisection.getSubgraph().totalDegree(),mqiBisection.getComplement().totalDegree());
    111113                        System.out.println("Conductance: " + newConductance);
     
    117119                        }
    118120                       
     121                        System.out.println();
    119122                        Iterator<Node> clustersNode = cluster.iterator();
    120123                        while(clustersNode.hasNext()){
Note: See TracChangeset for help on using the changeset viewer.