2 points by shader 308 days ago | link > Yes, there is semantic significance to adjacency & distance from the y-axis (which indicates an edge that connects parent and child nodes).Actually, it seems like your tree relationships have a very confusing relationship to the coordinates. Adding a newline increments Y, and a space increments X, but children are those nodes such that that`````` 1) child.Y > parent.Y 2) child.X == parent.X + 1 `````` With additional complications that only the node with the lowest X value for a given Y becomes the child; all others on the same line become part of the content of that node.This means that the relationships between two elements depends not just on their coordinates, but also the coordinates of nearby nodes. (6, 4) may or may not be a direct child of (5, 3); it depends on if (5, 3) is a full node, or just a content element that's actually part of (5, 2) or (5, 1).So the coordinates do not actually define the relationships between nodes; they do not clearly relate to the tree structure at all.-----
 2 points by breck 307 days ago | link You are right, this is great feedback thanks.> have a very confusing relationship to the coordinatesAgreed. I sometimes get confused too.One rule that always holds is this:`````` 1) One line === One node `````` So every node has an absolute Y coordinate (just the line number), but also a relative coordinate(s), relative to its ancestor(s).Both are useful at various times. There's probably a better way to eliminate confusion here.> So the coordinates do not actually define the relationships between nodesGiven an array of node coordinates {y,x} [{1,1}, {2,2}, {3,1}, {4,2}], one has enough information to define the whole tree structure of the program. But you are right, you need the full set of coordinates of a certain node's ancestors to properly know its coordinates, and having a line that begins with 1 or more spaces, it is impossible to deduce how many nodes deep it is without also having access to the previous line(s).-----