A good starting point is to specify your arrow graph using what is known as a "Free Arrow
". You can find one implementation of free Arrow
s in this Stack Overflow answer. Think of this as a syntactic representation of your Arrow
graph.
The nice thing about free Arrow
s is that they preserve the structure of the graph, which you can then display as a diagram. After displaying the graph of connections you can then use an interpreter to transform the free Arrow
to the desired Arrow
. One nice property that free Arrow
s have is that such an interpreter must be unique (up to isomorphism) by definition (that's one of the properties that makes it "free").