Template Class Lamg

Inheritance Relationships

Base Type

Class Documentation

template<class Matrix>
class Lamg : public NetworKit::LinearSolver<Matrix>

Represents the interface to the Lean Algebraic Multigrid (LAMG) graph Laplacian linear solver by Oren E. Livne and Achi Brandt.

See also

Livne, Oren E., and Achi Brandt. “Lean algebraic multigrid (LAMG): Fast graph Laplacian

linear solver.” SIAM Journal on Scientific Computing 34.4 (2012): B499-B522.

Public Functions

inline Lamg(const double tolerance = 1e-6)

Construct a solver with the given tolerance. The relative residual ||Ax-b||/||b|| will be less than or equal to tolerance after the solver finished.

Parameters:

tolerance

~Lamg() override = default

Default destructor

virtual void setup(const Matrix &laplacianMatrix) override

Compute the multigrid hierarchy for the given Laplacian matrix laplacianMatrix.

Note

This method also works for disconnected graphs. If you know that the graph is connected, if is faster to use setupConnected instead.

Parameters:

laplacianMatrix

virtual void setupConnected(const Matrix &laplacianMatrix) override

Compute the multigrid hierarchy for te given Laplacian matrix laplacianMatrix.

Note

The graph has to be connected for this method to work. Otherwise the output is undefined.

Parameters:

laplacianMatrix

virtual SolverStatus solve(const Vector &rhs, Vector &result, count maxConvergenceTime = 5 * 60 * 1000, count maxIterations = std::numeric_limits<count>::max()) override

Computes the result for the matrix currently setup and the right-hand side rhs. The maximum spent time can be specified by maxConvergenceTime and the maximum number of iterations can be set by maxIterations.

Parameters:
  • rhs

  • result

  • maxConvergenceTime

  • maxIterations

Returns:

A SolverStatus object which provides some statistics like the final absolute residual.

virtual void parallelSolve(const std::vector<Vector> &rhs, std::vector<Vector> &results, count maxConvergenceTime = 5 * 60 * 1000, count maxIterations = std::numeric_limits<count>::max()) override

Compute the results for the matrix currently setup and the right-hand sides rhs. The maximum spent time for each system can be specified by maxConvergenceTime and the maximum number of iterations can be set by maxIterations.

Parameters:
  • rhs

  • results

  • maxConvergenceTime

  • maxIterations

template<typename RHSLoader, typename ResultProcessor>
inline void parallelSolve(const RHSLoader &rhsLoader, const ResultProcessor &resultProcessor, std::pair<count, count> rhsSize, count maxConvergenceTime = 5 * 60 * 1000, count maxIterations = std::numeric_limits<count>::max())

Abstract parallel solve function that computes and processes results using resultProcessor for the matrix currently setup and the right-hand sides (size of rhsSize) provided by rhsLoader. The maximum spent time for each system can be specified by maxConvergenceTime and the maximum number of iterations can be set by maxIterations.

Note

If the solver does not support parallelism during solves, this function falls back to solving the systems sequentially.

Parameters:
  • rhsLoader

  • resultProcessor

  • rhsSize

  • maxConvergenceTime

  • maxIterations