How to calculate similarity between 2 users based on the images they share?
Use a similarity vector with the dimension of all possible similarities, which initially are set to zero everywhere. Go over the shared images of one user and for each image set the vector to 1 at the positions of the similarities from the image.
Do the same for another user.
Use the scalar product as similarity metric between the two users.
You can add weights for similarities which appear more than 1 time on the shared images.