Class KatzParallelGaussSeidel
public class KatzParallelGaussSeidel extends SpectralRanking
Warning: Since we need to enumerate the predecessors a node, you must pass to the constructor the transpose of the graph.
This class approximates the infinite summation
step() method is not available: due to the need for some synchronization logic, only stepUntil(StoppingCriterion)
is available.
Technically, the iteration performed by this class is a step-asynchronous Gauß–Seidel iteration: we simply start a number of threads, and each thread updates a value using a Gauß–Seidel-like rule. As a result, each update uses some old and some new values: in other words, the regular splitting
normDelta() returns the following values:
- if a suitable norm vector has been set, an upper bound on the error (the ℓ∞ distance from the rank to be computed);
- otherwise, an estimate of the ℓ∞ norm of the residual obtained by multiplying the ℓ∞ norm of the difference between the last two approximations by the ℓ∞ norm of αG (i.e., the maximum indegree multiplied by α).
To be able to set a norm vector, you need to use PowerSeries to compute a suitable vector.
To do so, you must provide an α and use the PowerSeries.MAX_RATIO_STOPPING_CRITERION. If the computation
terminates without errors with maximum ratio σ, the resulting vector can be used
with this class for all α < 1 / σ (strictness
is essential). Note that this is the only way to obtain a bound on the error (unless
your graph is so small that you can evaluate the ℓ∞ norm of (1 − αG)-1 and use it to bound the error using the residual).
Details about the method are described by Sebastiano Vigna in “Supremum-Norm Convergence for Step-Asynchronous Successive Overrelaxation on M-matrices“, 2014.
- Author:
- Sebastiano Vigna
- See Also:
PageRank,SpectralRanking,PowerSeries
-
Nested Class Summary
Nested classes/interfaces inherited from class it.unimi.dsi.law.rank.SpectralRanking
SpectralRanking.IterationNumberStoppingCriterion, SpectralRanking.NormStoppingCriterion, SpectralRanking.StoppingCriterion -
Field Summary
Fields Modifier and Type Field Description doublealphaThe attenuation factor.DoubleListpreferenceThe preference vector to be used (ornullif the uniform preference vector should be used).Fields inherited from class it.unimi.dsi.law.rank.SpectralRanking
DEFAULT_MAX_ITER, DEFAULT_NORM, DEFAULT_THRESHOLD, graph, iteration, logger, n, rank, STOCHASTIC_TOLERANCE -
Constructor Summary
Constructors Constructor Description KatzParallelGaussSeidel(ImmutableGraph transpose)Creates a new instance.KatzParallelGaussSeidel(ImmutableGraph transpose, int requestedThreads, Logger logger)Creates a new instance. -
Method Summary
Modifier and Type Method Description PropertiesbuildProperties(String graphBasename, String preferenceFilename)Returns a Properties object that contains all the parameters used by the computation.voidinit()Initializes the rank vector, zeroesSpectralRanking.iterationand logs basic data.static voidmain(String[] arg)doublenormDelta()Returns the norm of an estimation of the distance to the limit of the iterative process: depending on the implementation, this can be an actual bound or, for example, just the difference between the last two approximations.voidnormVector(double[] normVector, double sigma)Sets the norm vector.voidnormVector(String normVectorFilename, double sigma)Sets the norm vector.voidstep()Performs one computation step.voidstepUntil(SpectralRanking.StoppingCriterion stoppingCriterion)CallsSpectralRanking.init()and steps until a given stopping criterion is met.Methods inherited from class it.unimi.dsi.law.rank.SpectralRanking
and, approximateNormVector, buildProperties, clear, isStochastic, or
-
Field Details
-
alpha
public double alphaThe attenuation factor. Must be smaller than the reciprocal of the dominant eigenvalue. -
preference
The preference vector to be used (ornullif the uniform preference vector should be used).
-
-
Constructor Details
-
KatzParallelGaussSeidel
Creates a new instance.- Parameters:
transpose- the transpose of the graph on which to compute Katz's index.requestedThreads- the requested number of threads (0 forRuntime.availableProcessors()).logger- a logger that will be passed tosuper().
-
KatzParallelGaussSeidel
Creates a new instance.- Parameters:
transpose- the transpose of the graph on which to compute Katz's index.
-
-
Method Details
-
normVector
Sets the norm vector.- Parameters:
normVectorFilename- a file containing a norm vector as a list of doubles inDataInputformat, ornullfor no norm vector.sigma- the value for which the provided norm vector is suitable.- Throws:
IOException
-
normVector
public void normVector(double[] normVector, double sigma)Sets the norm vector.- Parameters:
normVector- the new norm vector.sigma- the value for which the provided norm vector is suitable.
-
init
Description copied from class:SpectralRankingInitializes the rank vector, zeroesSpectralRanking.iterationand logs basic data. Please extend this method to handle additional attributes.- Overrides:
initin classSpectralRanking- Throws:
IOException
-
step
Description copied from class:SpectralRankingPerforms one computation step.- Specified by:
stepin classSpectralRanking- Throws:
IOException
-
stepUntil
Description copied from class:SpectralRankingCallsSpectralRanking.init()and steps until a given stopping criterion is met. The criterion is checked a posteriori (i.e., after each step); this means that at least one step is performed.- Overrides:
stepUntilin classSpectralRanking- Parameters:
stoppingCriterion- the stopping criterion to be used.- Throws:
IOException
-
normDelta
public double normDelta()Description copied from class:SpectralRankingReturns the norm of an estimation of the distance to the limit of the iterative process: depending on the implementation, this can be an actual bound or, for example, just the difference between the last two approximations.This method must be implemented by concrete subclasses if you want to use
SpectralRanking.NormStoppingCriterion.- Overrides:
normDeltain classSpectralRanking- Returns:
- the norm of an estimation of the distance to the limit.
-
buildProperties
Returns a Properties object that contains all the parameters used by the computation.- Parameters:
graphBasename- file name of the graphpreferenceFilename- file name of preference vector. It can benull.- Returns:
- a properties object that represent all the parameters used to calculate the rank.
-
main
public static void main(String[] arg) throws IOException, JSAPException, ClassNotFoundException, ConfigurationException
-