3 ms·
> That has a direct translation into json: Sure, but this representation is horrific, and a very clear example of why json is not the appropriate format to sto
by enriquto 4y ago
> That has a direct translation into json:
Sure, but this representation is horrific, and a very clear example of why json is not the appropriate format to store graphs. A more natural format for graphs would replace your punctuation-ridden monstrosity with a simple text file, for example:
v1 v2
v1 v3
- spinningslate 4y agoI take your point, though you're not directly comparing like with like. I'd used a literal translation of (V, E) so listed vertices explicitly as well as edges. Using implicit representation (as you have), the json could be simplified to [["v1", "v2"], ["v1", "v3"]]. Still more syntax, definitely. But not far off, for example, the graphviz[0] equivalent in syntax overhead terms: graph { v1 -- v2; v1 -- v3; } To be clear, I'm no apologist for json. It just seemed to me there was a pretty direct representation. @rzzzt's observation on json being predominantly hierarchical and therefore tree-shaped seems like the most likely reason behond the original statement. -- [0] http://graphviz.org/ http://graphviz.org/