Ignore:
Timestamp:
Jan 6, 2011, 9:41:42 AM (14 years ago)
Author:
toshi
Message:

ultimo commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/localSpectral/src/clustering/LocalSpectral.java

    r34 r36  
    4949        rank.evaluate();
    5050        Collection<V> vertexs = graph.getVertices();
    51         Iterator<?> vertexsIterator = vertexs.iterator();
     51        Iterator<V> vertexsIterator = vertexs.iterator();
    5252        ArrayList<VertexScore<V>> vertexsScore = new ArrayList<VertexScore<V>>();
    5353        while(vertexsIterator.hasNext()){
    54             V vertex = (V) vertexsIterator.next();
     54            V vertex = vertexsIterator.next();
    5555            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());
    5757            vertexsScore.add(vertexscore);
    5858        }
     
    6262    }
    6363   
    64     public List<V> clusterPageRankPriors(V seed, double min_volume){
     64    public List<V> clusterPageRankPriors(List<V> seed, double min_volume){
    6565        PageRankWithPriors rank;
    6666        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
    6976        }
    7077        else{
     
    7986            V vertex = (V) vertexsIterator.next();
    8087            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);
    8390            vertexsScore.add(vertexscore);
    8491        }
     
    103110            int edge_boundary = 0;
    104111            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());
    106113                for(E out_edge : graph.getOutEdges(vertexsScore.get(j).getVertex())){
    107114                    V opposite = graph.getOpposite(vertexsScore.get(j).getVertex(), out_edge);
     
    117124
    118125                if ((volume_subset > min_volume) && (volume_subset < max_volume)){
    119                 //if (volume_subset < min_volume){
    120126                    if (conductance < min_conductance_subset){
    121127                        min_conductance_subset = conductance;
     
    143149    }
    144150
     151
    145152}
Note: See TracChangeset for help on using the changeset viewer.