Hello, I'm exploring the WGCNA package and am trying to understanding the math behind calculating values in a topological overlap matrix (TOM). I understand the purpose of TOM is to better estimate "connectedness" of 2 nodes/genes than merely correlation from the similarity matrix. I was reading through Horvath's paper (https://www.ncbi.nlm.nih.gov/pubmed/16646834) and I don't get this equation: if I have a mock network like this:

Graph adjacency matrix B A B C D / \ A 0 A-------D B 1 0 \ / C 1 0 0 C D 1 1 1 0

so A and D share exactly the same neighbours (B and C), and should have TOM = 1, how does one arrive at this with equation 4?

(oh, also I'm not sure if I should have 0 or 1 on the diagonal?)

Thank-you for your help,

Ming