Given two .dot
files, a1.dot
:
digraph g1 {
A -> B -> D -> E
A -> C -> E
}
... and a2.dot
:
digraph g2 {
A -> B -> F -> E
A -> C -> F
}
... you can find the nodes that are different between them as follows:
$ dot -Tplain a1.dot | sed -ne 's/^node \([^ ]\+\).*$/\1/p' | sort >a1.nodes
$ dot -Tplain a2.dot | sed -ne 's/^node \([^ ]\+\).*$/\1/p' | sort >a2.nodes
$ diff a1.nodes a2.nodes
4d3
< D
5a5
> F
I'm using sed
to strip the list of node names for each .dot
file out of the plain
output from dot
, sorting the nodes into order and then using diff
to find the differences. This approach doesn't present the differences graphically, but that is a tricky thing to do at the best of times.