Directed graph similarity calculation -- optimizing Mathematica code
Minor improvements, but consider using:

pList = ArrayFlatten[{{am\[Transpose], am}}];


and

dropDiagonal = MapThread[Delete, {#, Range@Length@#}] &amp;;


I also tried dropDiagonal = MapIndexed[Drop, #] &amp; but this is slower, at least in v7.



Replace:

Total[#1 #2]/Total[Sign[#1 + #2]] &amp;


With:

#.#2 / Tr@Unitize[#1 + #2] &amp;




I believe this is an improvement to your compiled function:

Compile[{{p, _Real, 2}}, 
  With[{b = p\[Transpose]},
    #.b / Total@Sign[# + b] &amp; /@ p
  ]
]