Normally, to represent a basic undirected graph in Lisp, I can create a list of parent nodes and their corresponding children nodes, as was discussed in this question (illustrated below for convenience).
this graph yields a list of edges:
(1 (2 6 7 8) 3 (4 (9 12)) 5 (10 11))
This works in the case of a tree or any other undirected graph. However, this type of representation breaks down when we want to represent a directed acyclic graph where each node can have multiple parents:
Now, Node 8 has multiple parents (2, 3), but when we attempt to represent this, we lose the ability to tell if node 8 is connected to two parent nodes, or if there are two node 8's:
(1 (2 6 7 8) (3 8) (4 (9 12)) (5 10 11))
In the case of a graph with unique nodes, we certainly can make this assumption, but to my knowledge, DAGs can have duplicate nodes ... so how do we deal with this? Further, how do we represent it as a list in Lisp?