graphs are created with Kite and serialized/exported in DOT. a DOT file can be imported into a Kite graph i.e. a GraphFile
is produced from DOT
:
|
fromDot : Dot -> GraphFile |
|
fromDot (Dot _ _ stmtList) = |
i assume this is true currently, but any graph should be able to be exported into DOT and then re-imported, creating the same graph as before.
(graph |> toDot |> fromDot) == graph
however, it seems like DOT produced by other programs, despite describing some graph with nodes and edges, can get imported as any empty graph with no nodes or edges.
to guarantee all exported graphs can be re-imported, fuzz testing is probably a good approach. generate random graphs and make sure that toDot >> fromDot
effectively does nothing.
if we have that guarantee, we can extend the fromDot
functionality to handle a wider variety of Dot
. i think the main issue is that Dot
represents the syntax AST of a DOT file. nodes and edges can be described in a few different ways, and i think fromDot
only looks for the places that toDot
uses.
we've talked about #7 before. i think it's a good goal, but we can't guarantee that fromDot >> toDot
is a no-op. we're definitely not producing the same String
of Dot.
i'm mainly dumping my thoughts out here, because i think it's a really useful improvement, but i don't want to do it yet lol