Index: branches/localSpectral/build/built-jar.properties
===================================================================
--- branches/localSpectral/build/built-jar.properties	(revision 33)
+++ branches/localSpectral/build/built-jar.properties	(revision 34)
@@ -1,3 +1,3 @@
-#Sat, 09 Oct 2010 22:35:12 +0200
+#Fri, 22 Oct 2010 14:15:58 +0200
 
 /home/luke/NetBeansProjects/Jung=
Index: branches/localSpectral/nbproject/project.properties
===================================================================
--- branches/localSpectral/nbproject/project.properties	(revision 33)
+++ branches/localSpectral/nbproject/project.properties	(revision 34)
@@ -76,8 +76,4 @@
     ${javac.classpath}:\
     ${build.classes.dir}
-# Space-separated list of JVM arguments used when running the project
-# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
-# or test-sys-prop.name=value to set system properties for unit tests):
-run.jvmargs=-Xms1G
 run.test.classpath=\
     ${javac.test.classpath}:\
Index: branches/localSpectral/src/clustering/Edge.java
===================================================================
--- branches/localSpectral/src/clustering/Edge.java	(revision 33)
+++ branches/localSpectral/src/clustering/Edge.java	(revision 34)
@@ -27,5 +27,8 @@
     }
 
-    
+    @Override
+    public String toString(){
+        return vertex1 + " --> "+ vertex2;
+    }
     
 
Index: branches/localSpectral/src/clustering/LocalSpectral.java
===================================================================
--- branches/localSpectral/src/clustering/LocalSpectral.java	(revision 33)
+++ branches/localSpectral/src/clustering/LocalSpectral.java	(revision 34)
@@ -92,4 +92,5 @@
         double min_conductance_subset=100;
         int min_conductance_index = -1;
+        int volume_cluster=0;
 
         int subsets_count = vertexsScore.size();
@@ -114,11 +115,13 @@
                     minvolume = volume_graph - volume_subset;
                 double conductance = edge_boundary / minvolume;
+
                 if ((volume_subset > min_volume) && (volume_subset < max_volume)){
+                //if (volume_subset < min_volume){
                     if (conductance < min_conductance_subset){
                         min_conductance_subset = conductance;
                         min_conductance_index = i;
+                        volume_cluster = volume_subset;
                     }
                 }
-                //System.out.println("CONDUCTANCE: "+conductance + " minvolume: "+minvolume + " edge_boundary: "+edge_boundary);
             }
 
@@ -126,11 +129,13 @@
         System.out.println("MIN CONDUCTANCE: "+min_conductance_subset);
 
-        System.out.println("CLUSTER: ");
+        System.out.println("CLUSTER: ("+min_conductance_index+" elements, volume "+ volume_cluster +", volume graph "+ 2 * this.graph.getEdgeCount()+")");
         List<V> cluster = new ArrayList<V>();
         for(int i=0; i< min_conductance_index; i++)
             cluster.add(vertexsScore.get(i).getVertex());
 
+        String node_list = "";
         for(V node : cluster)
-            System.out.println(node.toString());
+            node_list += node.toString() + ",";
+        System.out.println(node_list);
        
         return cluster;
Index: branches/localSpectral/src/data/GraphBuilder.java
===================================================================
--- branches/localSpectral/src/data/GraphBuilder.java	(revision 33)
+++ branches/localSpectral/src/data/GraphBuilder.java	(revision 34)
@@ -4,4 +4,5 @@
 import clustering.Edge;
 import clustering.VertexString;
+import edu.uci.ics.jung.graph.DirectedSparseGraph;
 import edu.uci.ics.jung.graph.Graph;
 import edu.uci.ics.jung.graph.SparseGraph;
@@ -22,7 +23,10 @@
     Graph<String,Edge<String>> graph;
 
-    public GraphBuilder(){
-        graph = new SparseGraph<String, Edge<String>>();
+    public GraphBuilder(boolean directed){
+        if (directed)
+           graph = new DirectedSparseGraph<String, Edge<String>>();
 
+        else
+            graph = new SparseGraph<String, Edge<String>>();
     }
 
Index: branches/localSpectral/src/jung/Main.java
===================================================================
--- branches/localSpectral/src/jung/Main.java	(revision 33)
+++ branches/localSpectral/src/jung/Main.java	(revision 34)
@@ -2,68 +2,24 @@
 package jung;
 
-import clustering.Edge;
-import clustering.LocalSpectral;
-import clustering.VertexScore;
-import clustering.VertexString;
-import data.GraphBuilder;
-import edu.uci.ics.jung.algorithms.scoring.PageRank;
-import edu.uci.ics.jung.graph.AbstractGraph;
-import edu.uci.ics.jung.graph.Graph;
-import edu.uci.ics.jung.graph.SparseGraph;
-import java.awt.Paint;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import view.VertexPaintTransformer;
-import view.Viewer;
+import clustering.GraphClusterer;
+
+
 
 public class Main {
 
     public static void main(String[] args) {
-       GraphBuilder builder = new GraphBuilder();
-       builder.buildGraphFromARFF("/home/luke/Desktop/reteUtentiMikeHidden.arff", 1000);
-       //builder.buildGraphFromARFF("/home/luke/Desktop/reteSemplice.txt", 10000);
-       Graph<String, Edge<String>> graph = builder.getGraph();
 
-       LocalSpectral<String,Edge<String>> clusterer = new LocalSpectral(graph);
-       List<VertexScore<String>> global_ranking = clusterer.getGlobalRank();
-
-       System.out.println("GLOBAL RANKING");
-       for(VertexScore<String> v : global_ranking)
-           System.out.println(v.toString());
-       
-       Viewer viewGraph = new Viewer(graph);
-       viewGraph.viewGraphRank(global_ranking,null);
-       //viewGraph.viewGraph(null);
-
-       
-       for(VertexScore<String> v : global_ranking){
-           Long stoptime = 5000L; 
-           try {
-                Thread.sleep(stoptime);
-            } catch (InterruptedException e) {}
-           List<String> cut = clusterer.clusterPageRankPriors(v.getVertex(),6);
-           Graph<String,Edge<String>> cut_graph = new SparseGraph<String, Edge<String>>();
-           for(String vertex : cut){
-               Collection<Edge<String>> out_edges = graph.getOutEdges(vertex);
-               for(Edge<String> edge : out_edges){
-                   String out_node = edge.getVertex2();
-                   if (cut.contains(out_node)){
-                       cut_graph.addEdge(edge, edge.getVertex1(),edge.getVertex2());
-                   }
-               }
-           }
-           viewGraph.setGraph(cut_graph);
-           viewGraph.viewGraph(null);
-           try {
-                Thread.sleep(stoptime);
-           } catch (InterruptedException e) {}
-           viewGraph.setGraph(graph);
-           viewGraph.viewGraphRank(global_ranking, null);
-       }
-        
+        String path_simply_net = "/home/luke/Desktop/reteSemplice.txt";
+        String path_mike_hiddent = "/home/luke/Desktop/reteUtentiMikeHidden.arff";
+        String karate_club = "/home/luke/Desktop/karate.csv";
+        String les_miserables = "/home/luke/Desktop/lesmis.csv";
+        String power_grids = "/home/luke/Desktop/power.csv";
+        String pol_blogs = "/home/luke/Desktop/polblogs.csv";
+        String dolphins = "/home/luke/Desktop/dolphins.csv";
+        String erdos_co_authors = "/home/luke/Desktop/erdos.csv";
+        GraphClusterer cl = new GraphClusterer(dolphins,false,60);
+        cl.clusterize(true);
 
     }
 
-
 }
Index: branches/localSpectral/src/view/VertexPaintRankTransformer.java
===================================================================
--- branches/localSpectral/src/view/VertexPaintRankTransformer.java	(revision 33)
+++ branches/localSpectral/src/view/VertexPaintRankTransformer.java	(revision 34)
@@ -13,15 +13,15 @@
 
     List<VertexScore<V>> pagerank;
-    List<V> cluster;
+    V seed_node;
 
-    public VertexPaintRankTransformer(List<VertexScore<V>> ranking, List<V> cluster){
+    public VertexPaintRankTransformer(List<VertexScore<V>> ranking, V seed_node){
         this.pagerank = ranking;
-        this.cluster = cluster;
+        this.seed_node = seed_node;
     }
 
     public Paint transform(V node) {
 
-        if(cluster != null){
-            if (cluster.contains(node)){
+        if(seed_node != null){
+            if (seed_node.equals(node)){
                 return (Paint) Color.GREEN;
             }
Index: branches/localSpectral/src/view/Viewer.java
===================================================================
--- branches/localSpectral/src/view/Viewer.java	(revision 33)
+++ branches/localSpectral/src/view/Viewer.java	(revision 34)
@@ -4,15 +4,25 @@
 import clustering.VertexScore;
 import clustering.VertexString;
+import edu.uci.ics.jung.algorithms.layout.DAGLayout;
 import edu.uci.ics.jung.algorithms.layout.FRLayout;
+import edu.uci.ics.jung.algorithms.layout.KKLayout;
 import edu.uci.ics.jung.algorithms.layout.Layout;
 import edu.uci.ics.jung.graph.Graph;
 import edu.uci.ics.jung.visualization.BasicVisualizationServer;
+import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Dimension;
+import java.awt.FlowLayout;
 import java.awt.LayoutManager;
 import java.awt.Paint;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.util.ArrayList;
 import java.util.List;
+import javax.swing.JButton;
 import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.xml.bind.JAXB;
 import org.apache.commons.collections15.Transformer;
 
@@ -25,16 +35,36 @@
     BasicVisualizationServer<V,E> vv;
     JFrame frame;
+    JButton button;
+    JPanel button_panel;
+    JTextArea text ;
 
-    public Viewer(Graph<V,E> graph) {
+    public Viewer(Graph<V,E> graph, ActionListener listerner) {
+        this.button = new JButton("Next");
+        this.button.addActionListener(listerner);
+        this.button_panel = new JPanel(new BorderLayout(100,100));
+        this.button_panel.add(button);
+        this.text = new JTextArea();
+        this.text.setEditable(false);
+        this.text.setBackground(Color.yellow);
+
         this.graph = graph;
-        this.frame = new JFrame("Graph View");
-        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-        layout = new FRLayout(graph);
-        layout.setSize(new Dimension(1000,700));
+        this.frame = new JFrame("Clustering with Google PageRank");
+        this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        KKLayout kklayout = new KKLayout(graph);
+        kklayout.setAdjustForGravity(false);
+        kklayout.setMaxIterations(100);
+        this.layout = kklayout;
+        layout.setSize(new Dimension(1280,700));
         vv = new BasicVisualizationServer(layout);
-        vv.setPreferredSize(new Dimension(1000,700));
+        vv.setPreferredSize(new Dimension(1280,700));
+        vv.add(this.button_panel);
+        vv.add(this.text);
         vv.getRenderContext().setVertexLabelTransformer(new VertexLabelTransformer<V, String>());
+       
     }
 
+    public void setText(String text){
+        this.text.setText(text);
+    }
     public void setGraph(Graph<V, E> graph) {
         this.graph = graph;
@@ -43,6 +73,6 @@
     }
     
-    public void viewGraphRank(List<VertexScore<V>> pagerank, List<V> cluster){
-         VertexPaintRankTransformer vertexPaint = new VertexPaintRankTransformer(pagerank,cluster);
+    public void viewGraphRank(List<VertexScore<V>> pagerank, V seed_node){
+         VertexPaintRankTransformer vertexPaint = new VertexPaintRankTransformer(pagerank,seed_node);
          vv.getRenderContext().setVertexFillPaintTransformer((Transformer<V, Paint>) vertexPaint);
          
@@ -67,3 +97,4 @@
 
      }
+
 }
