How to get the nth similar nodes in node similarity algorithm

I ran similarity algo (GDS) on a memory graph, this gives me this result (showing the result in the table format):

If I want to return the top similarity pair, I can use limit 1 instead of 3 to get the top result. (Result with the maximum similarity).

But I want to only return the third most similar similarity pair, how can I do that?
Basically, my result should be something like this:

Hello @abhishekjayant1111 :slight_smile:

You should have a look at SKIP, in your case:

ORDER BY similarity DESC SKIP 2 LIMIT 1

Regards,
Cobra

1 Like

Hi @Cobra , thanks for helping out again :slight_smile: . This is exactly what I wanted.
However, can you also tell me how to exclude the duplicate similarity pair when I run the node similarity algo. I've shown the duplicate pairs below:

I get these duplicate pairs, how can I get rid of these?
PS: I do now want to use write mode, only want to use stream.

1 Like

You can modify your WHERE clause like this:

WHERE n1:Adverse_Event
AND n2:Adverse_Event
AND id(n1) > id(n2)
1 Like

Solved the problem. Thank you so much! :grin:

1 Like