# Graph Difference

**URL:** <https://community.neo4j.com/t/graph-difference/60437>\
**Category:** Neo4j Graph Platform\
**Tags:** migrated\
**Created:** [June 22, 2022, 1:06pm UTC](https://community.neo4j.com/t/graph-difference/60437 "2022-06-22T13:06:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mochi](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@Mochi](https://community.neo4j.com/u/Mochi)\
**Post date:** [June 22, 2022, 1:06pm UTC](https://community.neo4j.com/t/graph-difference/60437/1 "2022-06-22T13:06:07Z")

</div>

Hello, I got a question. Is there any way to match and show graph difference? For example, I have an original graph and also a modified graph. This modified graph is generated by adding or removing a few nodes and relationships from the original one. Is there any way to find what nodes and relationships were modified? These 2 are different graphs. Hence I don't have any changing history or log to analyze. The way I come up with is to check each node's id and also its relationships, and see if they exist in the other graph. Any other ways? Thanks!

---

<div class="post-metadata">

**Author:** ![ameyasoft](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/ameyasoft/32/32639_2.png) [@ameyasoft](https://community.neo4j.com/u/ameyasoft)\
**Post date:** [June 22, 2022, 10:38pm UTC](https://community.neo4j.com/t/graph-difference/60437/2 "2022-06-22T22:38:49Z")

</div>

Run these queries on each DB:

MATCH (n)  
RETURN distinct labels(n) as lbl, count(distinct n ) as cnt order by cnt desc.

MATCH (n)-[r]-()  
RETURN distinct type(r) as rel, count(distinct r) as cnt order by cnt desc

Export the results as .csv file and compare. This is the first step.
