Generating a Tree Diagram from 'Flat' Data
Learn how to generate a tree diagram using "flat" data.
Tree diagrams are a fantastic way of displaying information. But one of the drawbacks (to the examples we’ve been using so far) is the need to have your data encoded hierarchically.
Flat data
Most data in a raw form will be flat. That is to say, it won’t be formatted as an array with the parent-child relationships. Instead, it will be a list of objects (which we will want to turn into nodes) that might describe the relationship to each other, but they won’t be encoded that way. For example, the following is the flat representation of the example data we have been using thus far. ...