I'm exploring the idea of using machine learning to draw a topology of elements. For example, imagine a tree representing geological hierarchy (country -> province -> city). All countries are at the top-most level, then the provinces for each country, followed by the provinces splitting into cities at the 3rd vertical level.
The vertical positions of the elements are trivial to compute:
- Country -> 0 %
- Province -> 33%
- City -> 66%
in a canvas going vertically down as the % increases.
However, I'm having trouble thinking of how to format the data to determine the horizontal position. I'm aware that there are non-ml algorithms to draw topologies, but I'm exploring this as a proof of concept.
My plan right now is to assign each element id,parentId,rank properties where
- id is a unique id
- parentId is the id of the parent element
- rank is 1/2/3
However, I feel like this isn't the best way to represent the data to feed into the ml model. I'm welcome to any guidance/recommendations on how to better represent the problem.