pt.tumba.links
Class SimRank

java.lang.Object
  extended by pt.tumba.links.SimRank

public class SimRank
extends java.lang.Object

SimRank is an iterative PageRank-like method for computing similarity. It goes beyond direct cocitation for computing similarity much as PageRank goes beyond direct linking for computing importance.

Author:
Bruno Martins

Field Summary
private  double dampening
          The value for the SimRank dampening factor
private  WebGraph graph
          The data structure containing the Web linkage graph
private  java.util.Map scores
          A Map containing the SimRank values for each page
 
Constructor Summary
SimRank(WebGraph graph)
          Constructor for SimRank
 
Method Summary
 void computeSimRank()
          Computes the SimRank value for all the nodes in the Web Graph.
 void computeSimRank(int iter)
          Computes the SimRank value for all the nodes in the Web Graph.
 double getDampening()
          Returns the dampening factor used for the SimRank Algorithm.
 void setDampening(double damp)
          Sets the value for the SimRank dampening factor.
private  java.util.Map simRank(java.lang.Integer id)
          Returns the SimRank score between a given link identifyer and all other links in the Web graph Identifyers are Integer numberes, used in WebGraph to represent the Web graph for efficiency reasons.
private  java.lang.Double simRank(java.lang.Integer id1, java.lang.Integer id2)
          Returns the SimRank score between two given link identifyers Identifyers are Integer numberes, used in WebGraph to represent the Web graph for efficiency reasons.
 java.util.Map simRank(java.lang.String link)
          Returns the SimRank score between a given link and all other links in the Web graph
 java.lang.Double simRank(java.lang.String link1, java.lang.String link2)
          Returns the SimRank score between two given links
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dampening

private double dampening
The value for the SimRank dampening factor


graph

private WebGraph graph
The data structure containing the Web linkage graph


scores

private java.util.Map scores
A Map containing the SimRank values for each page

Constructor Detail

SimRank

public SimRank(WebGraph graph)
Constructor for SimRank

Parameters:
graph - The data structure containing the Web linkage graph
Method Detail

setDampening

public void setDampening(double damp)
Sets the value for the SimRank dampening factor. The amount of SimRank that is transferred depends on a dampening factor which stands for “the probability that a random surfer will get bored”. The dampening factor generally is set to 0.85.

Parameters:
damp - The dampening factor

getDampening

public double getDampening()
Returns the dampening factor used for the SimRank Algorithm. The amount of SimRank that is transferred depends on a dampening factor which stands for “the probability that a random surfer will get bored”. The dampening factor generally is set to 0.85.

Returns:
The dampening factor

computeSimRank

public void computeSimRank()
Computes the SimRank value for all the nodes in the Web Graph. In this method, the number of iterations of the algorithm is set accordingly to the number of nodes in the Web graph.


computeSimRank

public void computeSimRank(int iter)
Computes the SimRank value for all the nodes in the Web Graph. The prodcedure can be found on the article SimRank: A Measure of Structural-Context Similarity.

Parameters:
iter - The number of iterations for the algorithm

simRank

public java.util.Map simRank(java.lang.String link)
Returns the SimRank score between a given link and all other links in the Web graph

Parameters:
link - The url for the link
Returns:
A Map with the Amsler score between the given link and all other links in the Web graph. Keys in the Map are link identifyers for all the other links, and values correspond to the Amsler score

simRank

public java.lang.Double simRank(java.lang.String link1,
                                java.lang.String link2)
Returns the SimRank score between two given links

Parameters:
link1 - The url for one of the links
link2 - The url for the other link
Returns:
The Amsler score between the two given links

simRank

private java.util.Map simRank(java.lang.Integer id)
Returns the SimRank score between a given link identifyer and all other links in the Web graph Identifyers are Integer numberes, used in WebGraph to represent the Web graph for efficiency reasons.

Parameters:
link - The identifyer for the link
Returns:
A Map with the Amsler score between the given link and all other links in the Web graph. Keys in the Map are link identifyers for all the other links, and values correspond to the Amsler score

simRank

private java.lang.Double simRank(java.lang.Integer id1,
                                 java.lang.Integer id2)
Returns the SimRank score between two given link identifyers Identifyers are Integer numberes, used in WebGraph to represent the Web graph for efficiency reasons.

Parameters:
link1 - The identifyer for one of the links
link2 - The identifyer for the other link
Returns:
The Amsler score between the two given link identifyers
See Also:
WebGraph.IdentifyerToURL()