arangodbarangojsarangodb-phpnosql

How to Compare Two Similar Graphs in ArangoDB that the result would yield the difference in Paths and Vertices?


I have two Graphs and I wanted to compare the difference between them. As a result from the AQL query I want only the difference in path and vertices between them. Is there any query in ArangoDb for it. Please let me know if its possible. Thanks in advance.


Solution

  • As first, you would execute both in a subquery:

    LET queryA = (RETURN {myFirstGraphResult: true, a: true, b: true})
    LET queryB = (RETURN {mySecondGraphResult: true, a: true, b: true})
    RETURN queryA == queryB
    

    Replace the two first RETURNs with your actual query. You need to make shure they're in the same sequence, so if you have an array in it with several paths, SORT it first.

    If you want to know the actual differences between the two paths, Jan has created a nice blogpost howto get the differences of two documnets in AQL