Mercurial > hg > Members > nobuyasu > TestNeo4j
changeset 27:4c0b10bb5192 draft default tip
print ./resource/wikiPageRank.log
author | one |
---|---|
date | Mon, 03 Sep 2012 16:25:28 +0900 |
parents | cfbab7d87188 |
children | |
files | src/wikigraph/LinkToNode.java src/wikigraph/ReadWikiLink.java src/wikigraph/WikiPage.java |
diffstat | 3 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/wikigraph/LinkToNode.java Fri Aug 31 20:17:49 2012 +0900 +++ b/src/wikigraph/LinkToNode.java Mon Sep 03 16:25:28 2012 +0900 @@ -255,7 +255,8 @@ sum += (Double) n.getProperty(PAGE_RANK); } if (wiki.getOutHasLink() == 0) { - pageRank = (double) ((double) 1 / AllNodeNumber * weight2); + pageRank = (double) sum * weight1 + + (double) ((double) 1 / AllNodeNumber * weight2); } else { pageRank = (double) ((double)sum / wiki.getOutHasLink() * weight1) + (double) ((double) 1 / AllNodeNumber * weight2);
--- a/src/wikigraph/ReadWikiLink.java Fri Aug 31 20:17:49 2012 +0900 +++ b/src/wikigraph/ReadWikiLink.java Mon Sep 03 16:25:28 2012 +0900 @@ -31,13 +31,10 @@ try { - // initALlNodePageRank(); +// ltn.initAllNodePageRank(); final long AllNodeNumber = ltn.searchAllNodes(); HashMap<String, WikiPage> wikiHash = ltn.getWikiPageHash(); -// ltn.printNodeInfo(2); - - WikiPage maxW = new WikiPage(); ArrayList<WikiPage> list = new ArrayList<WikiPage>(); for (String title : wikiHash.keySet()) { @@ -54,7 +51,7 @@ } }); - FileOutputStream fos = new FileOutputStream("./resource/wikipage2.log"); + FileOutputStream fos = new FileOutputStream("./resource/wikiPageRank.log"); for (WikiPage w : list) { w.printInfo(fos); @@ -63,11 +60,16 @@ System.out.println("\nMax Page Rank"); maxW.printInfo(); - - /* - final int nodeIds[] = {4, 5, 6}; + final int NODEID = 119392; + Node n = graphDb.getNodeById(NODEID); + n.setProperty(LinkToNode.PAGE_RANK,(double)0.0); + ltn.computePageRank(n); + ltn.printNodeInfo(NODEID); + +/* + final int nodeIds[] = {2892, 2850, 1574, 518, 3618}; LinkedList<FileOutputStream> fosList = new LinkedList<FileOutputStream>(); for (int i: nodeIds) { String filename = String.format("./resource/NodeId_%d.dat", i); @@ -90,7 +92,7 @@ for (FileOutputStream fos: fosList) { fos.close(); } - */ +*/ } catch (Exception e) { e.printStackTrace();
--- a/src/wikigraph/WikiPage.java Fri Aug 31 20:17:49 2012 +0900 +++ b/src/wikigraph/WikiPage.java Mon Sep 03 16:25:28 2012 +0900 @@ -85,6 +85,7 @@ void printInfo(FileOutputStream fos) throws IOException { fos.write(("id:"+id+" title:"+title+" rank:"+rank+"\n").getBytes()); fos.write(("outHasLink:"+outHasLink+" inHasLink:"+inHasLink+"\n").getBytes()); + fos.write(("\n").getBytes()); fos.flush(); }