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_1
the 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 Norm
DEFAULT_DOMINANT_EIGENVECTOR_NORM
The default norm (Norm.L_2
).double
lambda
The dominant eigenvalue.boolean
markovian
if true, the matrix will be stocasticized.Norm
norm
The norm.double[]
previousRank
The rank vector after the last iteration (only meaningful after at least one step).double
shift
A 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 Properties
buildProperties(String graphBasename)
Returns a Properties object that contains all the parameters used by the computation.void
clear()
Clears all data and releases resources by nullingSpectralRanking.rank
(i.e., results we no longer be available).void
init()
Initializes the rank vector, zeroesSpectralRanking.iteration
and logs basic data.static void
main(String[] arg)
double
normDelta()
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.void
step()
Performs one computation step.void
stepUntil(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:SpectralRanking
Initializes the rank vector, zeroesSpectralRanking.iteration
and logs basic data. Please extend this method to handle additional attributes.- Overrides:
init
in classSpectralRanking
- Throws:
IOException
-
step
Description copied from class:SpectralRanking
Performs one computation step.- Specified by:
step
in classSpectralRanking
- Throws:
IOException
-
stepUntil
Description copied from class:SpectralRanking
CallsSpectralRanking.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:
stepUntil
in classSpectralRanking
- Parameters:
stoppingCriterion
- the stopping criterion to be used.- Throws:
IOException
-
normDelta
public double normDelta()Description copied from class:SpectralRanking
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.This method must be implemented by concrete subclasses if you want to use
SpectralRanking.NormStoppingCriterion
.- Overrides:
normDelta
in classSpectralRanking
- Returns:
- the norm of an estimation of the distance to the limit.
-
clear
public void clear()Description copied from class:SpectralRanking
Clears 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:
clear
in classSpectralRanking
-
buildProperties
Returns a Properties object that contains all the parameters used by the computation.- Overrides:
buildProperties
in classSpectralRanking
- Parameters:
graphBasename
- the basename of the graph.- Returns:
- a properties object that represent all the parameters used to calculate the rank.
-
main
-