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.

Relationship similarity

Hi,
I'm looking for a way to find path / relationship similarity between path's.
In the simplest case, I would start with triplet: Node - relation - Node.
I can simply convert the various properties of the triplet into a vector and use all vectors generated by all triplets of graph - for calculating the similarity.
Do you have any other idea for implementing path similarity, as GDS doesn't support embedding on relationship? (using embedding of the 2 nodes of the triplet would give poor results b/c it doesn't take into account the relation's properties)

Thanks,
Eli.

4 REPLIES 4

What do you mean by path/relationship similarity? Start there. Suppose we're only talking triplets.

(Alice)-[r1:KNOWS]->(Bob)
(John)-[r2:KNOWS]->(Steve)

What makes r1 & r2 similar or dissimilar?

Hi david
Please note that there is a seperate ontology for the domain that you are trying to master. And triplet has to conform to the domain ontology and grammer. You can link the triplets using sparql or graphql but the meaning of entities should be clear in your mind. I mean what do they map to in real world.
Thanking you
Sameer G

Hi David,
The similarity should be based on various properties of the nodes and the relationships, e.g.
(Alice {age:24, height:1.54})-[r1 {period:1h, access:'write'}-(Bob {age:76, height:1.82}) and same for another node-relationship-node, I would like to have a similarity measure between any path which consists of node-relationship-node in the graph, so that I'll be able to make for example link prediction.

OK. So graph data science has a series of Similarity Algorithms which can help in these use cases.

You may have relationships -- and I know a lot of those algorithms operate on nodes. But the key insight here is that graph data science lets you project a GDS graph out of a physical Neo4j graph.

In this chapter: Cypher projection - Neo4j Graph Data Science

It covers how you can write a cypher query which will return which nodes and rels you want in your GDS graph.

A common modeling technique is for people to "reify" relationships into nodes. For example:

(:Account)-[:TRANSFER { amount: 1 }]->(:Account)

Can be reified into

(:Account)-[:STEP]->(:AccountTransfer { amount: 1 })-[:STEP]->(:Account)

Boom, a relationship is a node.

If you wanted to find similarity of relationships, the thing I would suggest to do is to project a monopartite graph of reified relationships, and then just run any old regular similarly algorithm on that.