Changeset 36 for branches/localSpectral/src/clustering/LocalSpectral.java
- Timestamp:
- Jan 6, 2011, 9:41:42 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/localSpectral/src/clustering/LocalSpectral.java
r34 r36 49 49 rank.evaluate(); 50 50 Collection<V> vertexs = graph.getVertices(); 51 Iterator< ?> vertexsIterator = vertexs.iterator();51 Iterator<V> vertexsIterator = vertexs.iterator(); 52 52 ArrayList<VertexScore<V>> vertexsScore = new ArrayList<VertexScore<V>>(); 53 53 while(vertexsIterator.hasNext()){ 54 V vertex = (V)vertexsIterator.next();54 V vertex = vertexsIterator.next(); 55 55 Double score = (Double) rank.getVertexScore(vertex); 56 VertexScore<V> vertexscore = new VertexScore<V>(vertex,score );56 VertexScore<V> vertexscore = new VertexScore<V>(vertex,score.floatValue()); 57 57 vertexsScore.add(vertexscore); 58 58 } … … 62 62 } 63 63 64 public List<V> clusterPageRankPriors( Vseed, double min_volume){64 public List<V> clusterPageRankPriors(List<V> seed, double min_volume){ 65 65 PageRankWithPriors rank; 66 66 if(seed != null){ 67 Transformer transf = new SeedTransformer(seed); 68 rank = new PageRankWithPriors(graph, transf, alpha); 67 if(seed.size() == 1){ 68 Transformer transf = new SeedTransformer(seed.get(0)); 69 rank = new PageRankWithPriors(graph, transf, alpha); 70 } 71 else{ 72 Transformer transf = new ListSeedTransformer(seed); 73 rank = new PageRankWithPriors(graph, transf, alpha); 74 } 75 69 76 } 70 77 else{ … … 79 86 V vertex = (V) vertexsIterator.next(); 80 87 Double score = (Double) rank.getVertexScore(vertex); 81 int degree = graph. getIncidentEdges(vertex).size();82 VertexScore<V> vertexscore = new VertexScore<V>(vertex,score /degree);88 int degree = graph.inDegree(vertex); 89 VertexScore<V> vertexscore = new VertexScore<V>(vertex,score.floatValue()/degree); 83 90 vertexsScore.add(vertexscore); 84 91 } … … 103 110 int edge_boundary = 0; 104 111 for(int j=0; j<i; j++){ 105 volume_subset += graph. getIncidentEdges(vertexsScore.get(j).getVertex()).size();112 volume_subset += graph.inDegree(vertexsScore.get(j).getVertex()); 106 113 for(E out_edge : graph.getOutEdges(vertexsScore.get(j).getVertex())){ 107 114 V opposite = graph.getOpposite(vertexsScore.get(j).getVertex(), out_edge); … … 117 124 118 125 if ((volume_subset > min_volume) && (volume_subset < max_volume)){ 119 //if (volume_subset < min_volume){120 126 if (conductance < min_conductance_subset){ 121 127 min_conductance_subset = conductance; … … 143 149 } 144 150 151 145 152 }
Note: See TracChangeset
for help on using the changeset viewer.