|
Enjoyed this, as with most of Hillel Wayne's writing. One bit that puzzled me: > “Representation” is similar to mimicry, except it’s about encoding a data structure in primitives that aren’t well-suited to it. Examples would be representing a tree in SQL tables, representing a matrix with nested arrays, or representing a graph in json. I can see the first two exampples (tree in SQL, matrix as nested arrays) because there are limitations in the representation. The last one though (graph in json) doesn't seem obviously limited. Mathematically, a graph G=(V, E), i.e. a set V of vertices (nodes) and a set E of edges between nodes. That has a direct translation into json: {
"G": {
"V": ["v1", "v2", "v3"],
"E": [["v1", "v2"], ["v1", "v3"]]
}
}
Perhaps it's that each edge is encoded as a list? Or that lists aren't sets, so there might be duplicates? Enlightenment appreciated.-- EDIT: fixed typo. |
For the past year or so I've been "typing graphs" into YAMLs. It's definitely doable, but hard to follow, especially with cyclic graphs.
N8N is a very popular nocode workflow builder with a great UI. They store workflows (graphs) as JSON. I use this complicated workflow https://n8n.io/workflows/1534-back-up-your-n8n-workflows-to-... in my homelab but I can't find a public JSON representation of it. It'd be a great example of how to present a complicated graph. I'll add it as an edit if I find it.
EDIT: I found one public workflow backup on github. https://raw.githubusercontent.com/thethanghn/n8n-workflows/d...
It's not that bad.