5 ms·
Is it possible to express a JSON graph (as opposed to a simple tree)? I didn't think it was.
by chrisseaton 4y ago
Is it possible to express a JSON graph (as opposed to a simple tree)? I didn't think it was.
- tunesmith 4y agoDoes JSON Crack support a node having multiple parents?
- nixpulvis 4y agoWhat is a JSON graph?
- deleted 4y ago[deleted]
- chrisseaton 4y agoA general graph is a tree without the restriction that a node can have at most one parent.
- nixpulvis 4y agoCorrect. So how is JSON a graph? Or maybe the answer is just, No. Not generally. I'm confused by your question.
- deleted 4y ago[deleted]
- chrisseaton 4y agoYou're just repeating what I originally asked?
- 8note 4y agoEach object is a node. { Left:{}, Right:{} } Has a tree with 3 nodes If you don't parse the JSON, you tend to traverse it as a graph
- worg 4y agoI think the author means Diagram instead of graph as data structure
- chrisseaton 4y agoAh, right. I thought they had some adjacency list format or something.
- aliqot 4y agoThat is a graph. It has vertices and edges. Any tree or hierarchical structure can be expressed this way.
- worg 4y agoOf course the display representation on the tool is indeed a graph, but some people might wonder how one can represent a multi-parent node in a JSON tree or have some cyclic structure, which of course is not possible and cause confusion
- jeffreygoesto 4y agoWith JSON pointers [0] this is possible. For example OpenAPI allows them. Can be a pretty useful extension. [0] https://www.rfc-editor.org/rfc/rfc6901 https://www.rfc-editor.org/rfc/rfc6901
- aliqot 4y agoAll JSON would be an acyclic graph, as JSON does not support cyclically linked elements (that I'm aware of). You'd represent encapsulated JSON objects with a structure like a 'polyforest tree'. If cyclicallity is needed specifically, cyclic graphs do exist, but it was my impression that JSON doesn't have these, or I'm unable to imagine how that would work. While two fields may have the same 'value' in a JSON object, I don't know how I could express cyclicallity using normal JSON syntax to say that two identical values would be linked cyclically.
- 4y ago
- zwkrt 4y agotrees are graphs, so there is no problem!