# What could be the best way to show difference between two branches?

**URL:** <https://discuss.dgraph.io/t/what-could-be-the-best-way-to-show-difference-between-two-branches/17072>\
**Category:** Dgraph\
**Tags:** kind:question\
**Created:** [March 22, 2022, 9:27am UTC](https://discuss.dgraph.io/t/what-could-be-the-best-way-to-show-difference-between-two-branches/17072 "2022-03-22T09:27:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maubertin](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@maubertin](https://discuss.dgraph.io/u/maubertin)\
**Post date:** [March 22, 2022, 9:27am UTC](https://discuss.dgraph.io/t/what-could-be-the-best-way-to-show-difference-between-two-branches/17072/1 "2022-03-22T09:27:54Z")

</div>

Hi all,

I currently use Dgraph to identify change performed between two snapshots.

My graph looks like:

Snap1 → root → branch(x) → subbranch(y) → leafs(z)  
Snap2 → root → branch(x’) → subbranch(y’) → leafs(z’)

I aims to request Snap1 and Snap2 to highlight difference between the two snap (new branchs, deleted subbranches or leafs…). All differences.

I’d like to get the community point of view regarding this use case.

Thank’s in advance for your time, opinions, known best practices and ideas.

---

<div class="post-metadata">

**Author:** ![pshaddel](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/pshaddel/32/11584_2.png) [@pshaddel](https://discuss.dgraph.io/u/pshaddel)\
**Post date:** [March 22, 2022, 12:20pm UTC](https://discuss.dgraph.io/t/what-could-be-the-best-way-to-show-difference-between-two-branches/17072/2 "2022-03-22T12:20:55Z")

</div>

Hey @maubertin  
Interesting usage 🙂  
From my point of view if you have a tree structure then choosing to store that in a graph database is a good choice and it looks like you already made that choice.  
About comparing these 2 snapshots: I think it is not that much related to database, the database role here is to help you insert these snapshots and query them efficiently. I should add that with the tools dgraph offers you can easily implement a **lambda function** to do this comparison and returning the result.

Also your usage is somehow like a version control system like **Git**. [TerminusDB](https://github.com/terminusdb/terminusdb) is claiming that their database works like that.

They have a [diff and patch](https://terminusdb.com/docs/index/json-diff-and-patch#diff-and-patch-endpoints) cloud offering too.You can do this JSON comparison in lambda function too, it is not a big deal I guess.

---

<div class="post-metadata">

**Author:** ![maubertin](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@maubertin](https://discuss.dgraph.io/u/maubertin)\
**Post date:** [March 22, 2022, 12:54pm UTC](https://discuss.dgraph.io/t/what-could-be-the-best-way-to-show-difference-between-two-branches/17072/3 "2022-03-22T12:54:27Z")

</div>

Really appreciate @pshaddel !

Thank you very much.
