datafu.linkanalysis
Class PageRank

java.lang.Object
  extended by datafu.linkanalysis.PageRank

public class PageRank
extends java.lang.Object

An implementation of PageRank. This implementation is not distributed. It is intended for graphs of a reasonable size which can be processed on a single machine. Nodes are stored in memory. Edges are stored in memory and can optionally be spilled to disk once a certain limit is reached.


Nested Class Summary
static interface PageRank.ProgressIndicator
           
 
Constructor Summary
PageRank()
           
 
Method Summary
 void addEdges(java.lang.Integer sourceId, java.util.ArrayList<java.util.Map<java.lang.String,java.lang.Object>> sourceEdges)
           
 void clear()
           
 void commit(PageRank.ProgressIndicator progressIndicator)
           
 void disableDanglingNodeHandling()
          Disables dangling node handling (disabled by default).
 void disableEdgeDiskCaching()
          Disable disk caching of edges once there are too many (disabled by default).
 void distribute(PageRank.ProgressIndicator progressIndicator)
           
 long edgeCount()
           
 void enableDanglingNodeHandling()
          Enables dangling node handling (disabled by default).
 void enableEdgeDiskCaching()
          Enable disk caching of edges once there are too many (disabled by default).
 long getEdgeCachingThreshold()
          Gets the number of edges past which they will be cached on disk instead of in memory.
 it.unimi.dsi.fastutil.ints.Int2IntMap.FastEntrySet getNodeIds()
           
 float getNodeRank(int nodeId)
           
 float getTotalRankChange()
           
 void init(PageRank.ProgressIndicator progressIndicator)
           
 boolean isEdgeDiskCachingEnabled()
          Gets whether edge disk caching is enabled.
 boolean isUsingEdgeDiskCache()
          Gets whether disk is being used to cache edges.
 float nextIteration(PageRank.ProgressIndicator progressIndicator)
           
 long nodeCount()
           
 void setEdgeCachingThreshold(long count)
          Set the number of edges past which they will be cached on disk instead of in memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageRank

public PageRank()
Method Detail

clear

public void clear()
           throws java.io.IOException
Throws:
java.io.IOException

isUsingEdgeDiskCache

public boolean isUsingEdgeDiskCache()
Gets whether disk is being used to cache edges.

Returns:
True if the edges are cached on disk.

enableEdgeDiskCaching

public void enableEdgeDiskCaching()
Enable disk caching of edges once there are too many (disabled by default).


disableEdgeDiskCaching

public void disableEdgeDiskCaching()
Disable disk caching of edges once there are too many (disabled by default).


isEdgeDiskCachingEnabled

public boolean isEdgeDiskCachingEnabled()
Gets whether edge disk caching is enabled.

Returns:
True if edge disk caching is enabled.

getEdgeCachingThreshold

public long getEdgeCachingThreshold()
Gets the number of edges past which they will be cached on disk instead of in memory. Edge disk caching must be enabled for this to have any effect.

Returns:
Edge count past which caching occurs

setEdgeCachingThreshold

public void setEdgeCachingThreshold(long count)
Set the number of edges past which they will be cached on disk instead of in memory. Edge disk caching must be enabled for this to have any effect.

Parameters:
count - Edge count past which caching occurs

enableDanglingNodeHandling

public void enableDanglingNodeHandling()
Enables dangling node handling (disabled by default).


disableDanglingNodeHandling

public void disableDanglingNodeHandling()
Disables dangling node handling (disabled by default).


nodeCount

public long nodeCount()

edgeCount

public long edgeCount()

getNodeIds

public it.unimi.dsi.fastutil.ints.Int2IntMap.FastEntrySet getNodeIds()

getNodeRank

public float getNodeRank(int nodeId)

getTotalRankChange

public float getTotalRankChange()

addEdges

public void addEdges(java.lang.Integer sourceId,
                     java.util.ArrayList<java.util.Map<java.lang.String,java.lang.Object>> sourceEdges)
              throws java.io.IOException
Throws:
java.io.IOException

init

public void init(PageRank.ProgressIndicator progressIndicator)
          throws java.io.IOException
Throws:
java.io.IOException

nextIteration

public float nextIteration(PageRank.ProgressIndicator progressIndicator)
                    throws java.io.IOException
Throws:
java.io.IOException

distribute

public void distribute(PageRank.ProgressIndicator progressIndicator)
                throws java.io.IOException
Throws:
java.io.IOException

commit

public void commit(PageRank.ProgressIndicator progressIndicator)


Matthew Hayes, Sam Shah