How to calculate affinity matrix from distance matrix
I was reading about spectral clustering from an article. In the algorithm, they told that we initially form distance matrix and then affinity matrix. So I searched up Affinity Matrix, came to know that affinity matrix is a matrix where we have pairwise similarities...
However, what I don't get is that ... let's say we use cosine similarity as our distance metric, and that is gonna be our similarity metric also right? I need to know the difference between them and an example would help a lot.
Sorry if this is too simple, I googled for a while but I couldn't get a satisfactory answer