[27] | 1 | /* |
---|
| 2 | * To change this template, choose Tools | Templates |
---|
| 3 | * and open the template in the editor. |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | package jung; |
---|
| 7 | |
---|
| 8 | import clustering.LocalSpectral; |
---|
| 9 | import clustering.VertexScore; |
---|
| 10 | import data.GraphBuilder; |
---|
| 11 | import edu.uci.ics.jung.algorithms.scoring.PageRank; |
---|
| 12 | import edu.uci.ics.jung.graph.Graph; |
---|
| 13 | import edu.uci.ics.jung.graph.SparseGraph; |
---|
| 14 | import java.awt.Paint; |
---|
| 15 | import java.util.ArrayList; |
---|
| 16 | import java.util.Collection; |
---|
| 17 | import java.util.List; |
---|
| 18 | import view.VertexPaintTransformer; |
---|
| 19 | import view.Viewer; |
---|
| 20 | |
---|
| 21 | public class Main { |
---|
| 22 | |
---|
| 23 | public static void main(String[] args) { |
---|
| 24 | GraphBuilder builder = new GraphBuilder(); |
---|
| 25 | builder.buildGraphFromARFF("/home/luke/Desktop/reteSemplice.txt", 6000); |
---|
| 26 | Graph<String, Integer> graph = builder.getGraph(); |
---|
| 27 | Viewer viewGraph = new Viewer(graph); |
---|
| 28 | viewGraph.viewGraph(null); |
---|
| 29 | LocalSpectral<String,Integer> clusterer = new LocalSpectral(graph); |
---|
| 30 | List<VertexScore<String>> global_ranking = clusterer.getGlobalRank(); |
---|
| 31 | System.out.println("GLOBAL RANKING"); |
---|
| 32 | for(VertexScore<String> v : global_ranking) |
---|
| 33 | System.out.println("VERTEX: "+v + " RANK "+v.getScore()); |
---|
| 34 | for(VertexScore<String> v : global_ranking){ |
---|
| 35 | Long stoptime = 5000L; |
---|
| 36 | try { |
---|
| 37 | Thread.sleep(stoptime); |
---|
| 38 | } catch (InterruptedException e) {} |
---|
| 39 | List<String> cut = clusterer.clusterPageRankPriors(v.getVertex(),6); |
---|
| 40 | viewGraph.viewGraph(cut); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | } |
---|