# Triplets similarities how to?

**URL:** https://community.neo4j.com/t/triplets-similarities-how-to/43576
**Category:** Cypher
**Tags:** cypher
**Created:** [August 28, 2021, 1:07pm UTC](https://community.neo4j.com/t/triplets-similarities-how-to/43576 "2021-08-28T13:07:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![steve5](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/steve5/32/3933_2.png) [@steve5](https://community.neo4j.com/u/steve5)
#### Post date: [August 28, 2021, 1:07pm UTC](https://community.neo4j.com/t/triplets-similarities-how-to/43576/1 "2021-08-28T13:07:41Z")

</div>

I have a lot of triplets (node, relation, node or circle, relation, circle) with different attributes for each user node (it can contain user\_id, location, role for some nodes and others can be without location but with their marital status, use\_car etc.) and data node.

Data node can contain location, size, origin and sometimes it will contain only the location. I have a relation between these nodes - that has some attributes like folder\_name, approved/rejected etc.

Given a new triplet, how can I find the most similar triplets by their attributes (user node + relation + data node)

Is there any functionality to do this? I will be happy to get a direction to check or minimal example.

---

<div class="post-metadata">

### Author: ![dhruv.sharma8826](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dhruv.sharma8826/32/4888_2.png) [@dhruv.sharma8826](https://community.neo4j.com/u/dhruv.sharma8826)
#### Post date: [August 29, 2021, 4:21am UTC](https://community.neo4j.com/t/triplets-similarities-how-to/43576/2 "2021-08-29T04:21:38Z")

</div>

Hi Steve,

1- There is another discussion on the community forum similar to your question and has a few suggestions there. It can be found on-\>  
[How to find similarity between two graphs in Neo4j?](https://community.neo4j.com/t/how-to-find-similarity-between-two-graphs-in-neo4j/12387).  
This might provide you some options to try out and see what best works.

2- GDS (Graph data science) library of Neo4j also provides out of box support for some similarity algorithms that could used, which one best fits is subjected to the exact use case you want to achieve.

> **[Node Similarity - Neo4j Graph Data Science](https://neo4j.com/docs/graph-data-science/current/algorithms/node-similarity/)**
>
> This section describes the Node Similarity algorithm in the Neo4j Graph Data Science library. The algorithm is based on the Jaccard and Overlap similarity metrics.

3- Apoc also provides graph comparison algorithms like fingerprinting, around which a solution can be created.

> **[Fingerprinting - APOC Extended Documentation](https://neo4j.com/labs/apoc/4.1/comparing-graphs/fingerprinting/)**
>
> This section describes procedures that can be used to create a hash over nodes, relationships or the whole graph.

What would exactly fit for your use case is subjective to the problem, the solution looking for, the neo4j db performance, etc. I would recommend you to go through all these option and take the best 2-3 options and try them over a POC to see what best solves your problem and is also efficient with your current neo4j configurations.

Regards,  
D
