Question

I am having trouble understanding how the JUNG graph handles edgeweights. I am using PageRankWithPriors and when I use the constructor without edge weights I get OK results, but when I construct the PageRankWithPriors with edgeweights I get no results. PageRankWithPriors .getVertexScore() returns "NaN"

here is the constructor:

PageRankWithPriors<customVertex, customEdge> ranker = new PageRankWithPriors<customVertex, customEdge>(graph.getGraph(),
        new Transformer<customEdge, Double>() {
      @Override
      public Double transform(customEdge edge) {

          return edge.getnormalizedWeight();
      }
    },
    new Transformer<customVertex, Double>() {
      @Override
      public Double transform(customVertex vertex) {
        //return getSourceNodes().contains(vertex) ? 1.0 : 0;
          if (priorityVertexList !=null){
              if (priorityVertexList.contains(vertex)) return new Double((0.85/priorityVertexList.size())).doubleValue();
              else return new Double((0.15/(graph.getGraph().getVertexCount()-priorityVertexList.size()))).doubleValue();
          }
          else{
              return new Double((0.15/(graph.getGraph().getVertexCount()))).doubleValue();
          }
      }
    }, alpha);

so my question is how the edgeweights are interpreted... can I give an edge weight of 5 or does it have to be between 0 and 1? (propability)

Was it helpful?

Solution

The edge weights represent transition probabilities, so the sum of the weights on the outgoing edges of a given vertex must be 1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top