How to compare two diagram models and find the difference?


We want to provide a diagram comparison feature (older vs latest version) in our application (currently showing two diagrams horizontally in the screen). Modified/Added/Deleted nodes and links would be highlighted in the latest version.

The idea is to traverse the graph and check whether any node/link is removed/added/modified and if so, add respective flags (isAdded, isModified, isDeleted) to highlight those.

Is there any way to find differences between two diagrams models? If we’ll to implement graph traversal algorithm for this in the client side, will that degrade the performance of the application?

Please suggest an approach to solve this.


It’s not quite that simple to show that a node or a link has been deleted, because there is nothing to highlight.

Also the semantics for comparing data is highly application-dependent. For example, comparing two Arrays might or might not care about the order of its items – it depends on whether the Array represents an ordered list or a set or something else.

I might be able to come up with a sample app for you later today when I get some free time.

Ok Walter. It’ll be really helpful for me if you share a sample app.

1 Like