Basically, SLAM requires optimization to align the noisy observation “due to sensors” with the noisy prediction due to “process and modelling uncertainties” with an optimum way so that it match the real robot trajectory. [1]
The optimization is mainly divided into two approaches in general. Filtering and least square error minimization methods.
Extended kalman filter, rao-blackwellized particle filter,etc. are some examples of filtering approach for SLAM optimization.
On the other side, Graph SLAM is one of the methods that apply the least square error minimization.
Footnotes
[1] SLAM - PythonRobotics documentation