cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Clarification on Jaccard Similarity Algorithm

sucheta
Graph Buddy

Hi,

I am using the following query with two nodes with names -applicationname and username and they lie within the same level .i.e. they are connected to the same node. Ain't there a similarity between them ?
If yes , why doesn't it show and if not which algorithm and query is suitable to find there similairty.

MATCH (p1 {name: 'applicationname'})-[*]->(cuisine1)
WITH p1, collect(id(cuisine1)) AS p1Parameter
MATCH (p2 {name: "username"})-[*]->(cuisine2)
WITH p1, p1Parameter, p2, collect(id(cuisine2)) AS p2Parameter
RETURN p1.value, p1.apiName AS from,
       p2.value, p2.apiName AS to,
       algo.similarity.jaccard(p1Parameter, p2Parameter) AS similarity

image of the node connection -

2X_c_c61aa7ff0124f78a62ac13413b9a1910c1851d32.png

1 REPLY 1

anthapu
Graph Fellow

From the diagram it looks like the relationship direction is opposite to what you have mentioned in the code. Can you switch the relationship direction and try again?