Package it.unimi.dsi.law.rank
Class DominantEigenvectorParallelPowerMethod
java.lang.Object
it.unimi.dsi.law.rank.SpectralRanking
it.unimi.dsi.law.rank.DominantEigenvectorParallelPowerMethod
public class DominantEigenvectorParallelPowerMethod extends SpectralRanking
Computes the left dominant eigenvalue and eigenvector of a graph using a parallel implementation of the power method.
At the end of the computation,
lambda will contain an approximation of the dominant eigenvalue.
- If the Markovian flag has been set, the rows of the adjacency matrix will be ℓ1-normalized.
normDelta()returns the difference in norm between the previous approximation of the dominant eigenvector and the product of the previous approximation by the graph, divided by the current estimate of the dominant eigenvalue obtained by Rayleigh quotients.- The
step()method is not available: due to the need for some synchronization logic, onlystepUntil(StoppingCriterion)is available. - The computed eigenvector will be a unit vector in the specified
norm. In particular, in the Markovian case if you use a norm different from
Norm.L_1the dominant eigenvector will need to be ℓ1-normalized to be a distribution. - It is strongly suggested that you apply a shift (e.g., -1). A negative shift guarantees convergence even in the presence of eigenvalues of maximum modulus that are not real positive (see a numerical linear algebra textbook for details).
- Author:
- Sebastiano Vigna
- See Also:
SpectralRanking
-
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 static NormDEFAULT_DOMINANT_EIGENVECTOR_NORMThe default norm (Norm.L_2).doublelambdaThe dominant eigenvalue.booleanmarkovianif true, the matrix will be stocasticized.NormnormThe norm.double[]previousRankThe rank vector after the last iteration (only meaningful after at least one step).doubleshiftA shift.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 DominantEigenvectorParallelPowerMethod(ImmutableGraph transpose)Creates a new instance.DominantEigenvectorParallelPowerMethod(ImmutableGraph transpose, int requestedThreads, Logger logger)Creates a new instance.DominantEigenvectorParallelPowerMethod(ImmutableGraph transpose, Logger logger)Creates a new instance. -
Method Summary
Modifier and Type Method Description PropertiesbuildProperties(String graphBasename)Returns a Properties object that contains all the parameters used by the computation.voidclear()Clears all data and releases resources by nullingSpectralRanking.rank(i.e., results we no longer be available).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.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, isStochastic, or
-
Field Details
-
DEFAULT_DOMINANT_EIGENVECTOR_NORM
The default norm (Norm.L_2). Works well with Rayleigh-quotient estimation of the dominant eigenvalue. -
previousRank
public double[] previousRankThe rank vector after the last iteration (only meaningful after at least one step). -
markovian
public boolean markovianif true, the matrix will be stocasticized. -
shift
public double shiftA shift. -
lambda
public double lambdaThe dominant eigenvalue. -
norm
The norm.
-
-
Constructor Details
-
DominantEigenvectorParallelPowerMethod
public DominantEigenvectorParallelPowerMethod(ImmutableGraph transpose, int requestedThreads, Logger logger)Creates a new instance.- Parameters:
transpose- the transpose of the graph.requestedThreads- the requested number of threads (0 forRuntime.availableProcessors()).logger- a logger that will be passed tosuper().
-
DominantEigenvectorParallelPowerMethod
Creates a new instance.- Parameters:
transpose- the transpose of the graph.logger- a logger that will be passed tosuper().
-
DominantEigenvectorParallelPowerMethod
Creates a new instance.- Parameters:
transpose- the transpose of the graph.
-
-
Method Details
-
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.
-
clear
public void clear()Description copied from class:SpectralRankingClears all data and releases resources by nullingSpectralRanking.rank(i.e., results we no longer be available). Please extend this method to handle additional attributes.- Overrides:
clearin classSpectralRanking
-
buildProperties
Returns a Properties object that contains all the parameters used by the computation.- Overrides:
buildPropertiesin classSpectralRanking- Parameters:
graphBasename- the basename of the graph.- Returns:
- a properties object that represent all the parameters used to calculate the rank.
-
main
-