@ Override public double similarity ( int vertexIdx1 , int vertexIdx2 ) { if ( vertexIdx1 == vertexIdx2 ) return 1.0 ; INDArray vector = Transforms . unitVec ( getVertexVector ( vertexIdx1 ) ) ; INDArray vector2 = Transforms . unitVec ( getVertexVector ( vertexIdx2 ) ) ; return Nd4j . getBlasWrapper ( ) . dot ( vector , vector2 ) ; }
Returns the cosine similarity of the vector representations of two vertices in the graph given the indices of these verticies