I have a graph database which will be populated with nodes containing text messages. Every time a node is saved, I need to calculate the similarity with respect to other nodes. the similarity metric can be any of these [https://neo4j.com/docs/labs/apoc/current/misc/text-functions/#text-functions-text-similarity] available within APOC. When the similarity is more than (say) 0.5, the query should establish a relationship SIMILAR_TO among those nodes compared.
My graph looks kind of like this:
As of now, this is a learning project/PoC.
I am looking for a cypher query or a stored procedure.
Can someone give me pointers on how to structure the query and anything else I must know before doing this?
I am aware that the complexity will increase exponentially as the nodes increase. But for now, I am not worrying about that.
I am using Neo4j version: 4.0.3 and python driver to create nodes.