Changeset 34 for branches/localSpectral/src/jung/Main.java
- Timestamp:
- Oct 30, 2010, 8:39:22 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/localSpectral/src/jung/Main.java
r32 r34 2 2 package jung; 3 3 4 import clustering.Edge; 5 import clustering.LocalSpectral; 6 import clustering.VertexScore; 7 import clustering.VertexString; 8 import data.GraphBuilder; 9 import edu.uci.ics.jung.algorithms.scoring.PageRank; 10 import edu.uci.ics.jung.graph.AbstractGraph; 11 import edu.uci.ics.jung.graph.Graph; 12 import edu.uci.ics.jung.graph.SparseGraph; 13 import java.awt.Paint; 14 import java.util.ArrayList; 15 import java.util.Collection; 16 import java.util.List; 17 import view.VertexPaintTransformer; 18 import view.Viewer; 4 import clustering.GraphClusterer; 5 6 19 7 20 8 public class Main { 21 9 22 10 public static void main(String[] args) { 23 GraphBuilder builder = new GraphBuilder();24 builder.buildGraphFromARFF("/home/luke/Desktop/reteUtentiMikeHidden.arff", 1000);25 //builder.buildGraphFromARFF("/home/luke/Desktop/reteSemplice.txt", 10000);26 Graph<String, Edge<String>> graph = builder.getGraph();27 11 28 LocalSpectral<String,Edge<String>> clusterer = new LocalSpectral(graph); 29 List<VertexScore<String>> global_ranking = clusterer.getGlobalRank(); 30 31 System.out.println("GLOBAL RANKING"); 32 for(VertexScore<String> v : global_ranking) 33 System.out.println(v.toString()); 34 35 Viewer viewGraph = new Viewer(graph); 36 viewGraph.viewGraphRank(global_ranking,null); 37 //viewGraph.viewGraph(null); 38 39 40 for(VertexScore<String> v : global_ranking){ 41 Long stoptime = 5000L; 42 try { 43 Thread.sleep(stoptime); 44 } catch (InterruptedException e) {} 45 List<String> cut = clusterer.clusterPageRankPriors(v.getVertex(),6); 46 Graph<String,Edge<String>> cut_graph = new SparseGraph<String, Edge<String>>(); 47 for(String vertex : cut){ 48 Collection<Edge<String>> out_edges = graph.getOutEdges(vertex); 49 for(Edge<String> edge : out_edges){ 50 String out_node = edge.getVertex2(); 51 if (cut.contains(out_node)){ 52 cut_graph.addEdge(edge, edge.getVertex1(),edge.getVertex2()); 53 } 54 } 55 } 56 viewGraph.setGraph(cut_graph); 57 viewGraph.viewGraph(null); 58 try { 59 Thread.sleep(stoptime); 60 } catch (InterruptedException e) {} 61 viewGraph.setGraph(graph); 62 viewGraph.viewGraphRank(global_ranking, null); 63 } 64 12 String path_simply_net = "/home/luke/Desktop/reteSemplice.txt"; 13 String path_mike_hiddent = "/home/luke/Desktop/reteUtentiMikeHidden.arff"; 14 String karate_club = "/home/luke/Desktop/karate.csv"; 15 String les_miserables = "/home/luke/Desktop/lesmis.csv"; 16 String power_grids = "/home/luke/Desktop/power.csv"; 17 String pol_blogs = "/home/luke/Desktop/polblogs.csv"; 18 String dolphins = "/home/luke/Desktop/dolphins.csv"; 19 String erdos_co_authors = "/home/luke/Desktop/erdos.csv"; 20 GraphClusterer cl = new GraphClusterer(dolphins,false,60); 21 cl.clusterize(true); 65 22 66 23 } 67 24 68 69 25 }
Note: See TracChangeset
for help on using the changeset viewer.