Below is a symmetric matrix $A$ with distances between observation $i$ and $j$.
$$ \begin{matrix} 0 & 9 & 8 & 6 & 3\\ 9 & 0 & 1 & 7 & 8\\ 8 & 1 & 0 & 6 & 9\\ 6 & 7 & 6 & 0 & 7\\ 3 & 8 & 9 & 7 & 0\\ \end{matrix} $$
My goal is to assign these into separate groups/clusters such the distance between observations within the group is minimized.
For example, the distance between observation 2 and 3 is 1 ($A_{23}$)
The distance between observation 1 and 5 is 3 ($A_{15}$)
According to that, observation 2 and 3 are likely to be part of the same "cluster". 1 and 5 also have a small distance of 3 between them, which also mean they should be part of the same "cluster". As you can see, observation 4 is very far from any other observation, which means it should be assigned to another "cluster".
The types of groups I initially trying to achieve according to the above example is as follows:
Cluster 1: observations 1, 5
Cluster 2: observations 2, 3
Cluster 3: observation 4
Do you know of an algorithm that can answer this kind of a problem?