I am in the process of creating a forum where user will be creating tags similar to the way Stack Overflow does.

To allow users to discover more and more questions, I liked the related tags in the right which comes when we visit a page of some particular tag.

So, I wanna know how two tags are considered related ? How can I calculate the distance between tags !

I just need the views or algorithm that can be used to calculate the distance.

Thanks !!


The "related tags" is nothing special. It just count the posts that have the same sets of tags. Two questions tagged [c] and [d] will show in the "related tags" of tag [c] or [d] as:

in [c]:

Related tags:

x 2

in [d]:

Related tags:

x 2

  • ohh Great :) I didn't know it was that easy !! Thanks a lot :) Jul 5 '14 at 1:27
  • How to do it efficiently when we have to find out related tags for a set of tags ? Jul 29 '14 at 2:59
  • @PrashantSingh use OR or AND between the tags
    – Braiam
    Jul 29 '14 at 5:03

Not the answer you're looking for? Browse other questions tagged .