How to calculate the Jaccard index
The Jaccard index is a measure of similarity between two sets. Take a look at the Wikipedia article here. It is very easy to compute:

The Jaccard similarity coefficient for sets X and Y is defined as:

J(X,Y) = |intersection(X,Y)| / |union(X,Y)|


Where | | indicates the size (number of elements) of the set. Imagine you have two sets X and Y defined as follows:

X = {A, B, C, D}
Y = {C, D, E, F, G}


Then:

intersection(X,Y) = {C, D} =&gt; |intersection(X,Y)| = 2
union(X,Y) = {A,B,C,D,E,F} =&gt; |union(X,Y)| = 5


Therefore: J(X,Y) = 2/5

Alternatively, the Jaccard distance would be D(X,Y) = 1 - J(X,Y) = 1 - 2/5 = 3/5

In Biology the Jaccard index has been used to compute the similarity between networks, by comparing the number of edges in common (e.g. Bass, Nature methods 2013)



Regarding applying it to compounds, if you have two sets with different compounds, you can find how similar the two sets are using this index. The elements on the sets, in this case the compounds, correspond to A, B, C, etc. in my example.