Mercurial > hg > Members > nobuyasu > TPPageRank
changeset 9:9787663edb54 draft
delete if expression in computePageRank method.
author | one |
---|---|
date | Wed, 05 Sep 2012 18:44:03 +0900 |
parents | 4d1885a2fa36 |
children | c7a7c53702dd |
files | src/pagerank/LinkToVertex.java src/pagerank/TPReadWikiLink.java |
diffstat | 2 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pagerank/LinkToVertex.java Wed Sep 05 17:19:59 2012 +0900 +++ b/src/pagerank/LinkToVertex.java Wed Sep 05 18:44:03 2012 +0900 @@ -217,13 +217,12 @@ for (Edge edge : v.getEdges(Direction.IN, HAS_LINK) ) { Vertex linkV = edge.getVertex(Direction.OUT); - if (computeInHasLink(linkV) == 0) { - sum += (Double) linkV.getProperty(PAGE_RANK); - } else { - sum += ((Double) linkV.getProperty(PAGE_RANK)) / computeInHasLink(linkV) ; - } + assert computeOutHasLink(linkV)!=0 ; + double pr = (Double)linkV.getProperty(PAGE_RANK); + sum += (double) pr / computeOutHasLink(linkV) ; } - pageRank = (double) (1 - weight) / AllVertexNumber + double tmp = (double) 1 - weight; + pageRank = (double) tmp / AllVertexNumber + (double) sum * weight; wiki.setRank(pageRank);
--- a/src/pagerank/TPReadWikiLink.java Wed Sep 05 17:19:59 2012 +0900 +++ b/src/pagerank/TPReadWikiLink.java Wed Sep 05 18:44:03 2012 +0900 @@ -40,11 +40,11 @@ HashMap<String, WikiPage> wikiHash = ltv.getWikiPageHash(); System.out.println("AllVertexNumber = "+AllVertexNumber); +/* + String nodeIds[] = {"80", "290", "21", "164"}; + writeComputeTransition(ltv, nodeIds, 50); -// String nodeIds[] = {"1574", "2829", "2850", "3618"}; -// writeComputeTransition(ltv, nodeIds, 50); - - +*/ FileOutputStream fos = new FileOutputStream(new File("./resources/wikiPageRank.log")); descendingOrder(wikiHash, fos);