I would like to combine nodes that are semantically identical in my application. Is there a tool or algorithm that I can use to process my chart?
Input example: nodes a and b must be combined.
digraph g { a -> {b;c;d;e}; b -> {a;c;d;e}; }
Graph image using dot :

Output example: nodes a and b were merged into node ab .. p>
digraph g { ab -> {c;d;e}; }

Rough Sketch Algorithm:
# XE = a set of nodes, represent a directed edge (x,_) # YE = a set of nodes, representing a directed edge (y,_) # XE \ y = XE except y # YE \ x = YE except x For each pair of nodes x,y If (edges (x,y) and (y,x) exists) AND (XE \ y == YE \ x) create new node xy -> xedges\y delete nodes x and y and their edges
source share