There's a webapp I'm developing that needs to draw rooted, n-ary trees dynamically, to map out the prerequisite relationships between skills. It actually already does this and you can see an example here. I'm trying to improve it though, using the algorithm laid out here in PyMag and I must admit, I'm a bit lost trying to figure out how to adapt it for my JavaScript code.
EDIT: Here is my current code for drawing these trees, from a Rails ERB partial (I would paste the code here, but it's a bit lengthy).
For those who do check out my code,gon.skills_map
is an array in this format:
- gon.skills_map[0] is the title of the skill in a string
- gon.skills_map[1] is the URL of the skill, so that each node is clickable
- gon.skills_map[2] is an array of postrequisite (it's what I'm calling the opposite of a prerequisite) arrays in this exact same format
- gon.skills_map[3] is the rating of the prerequisite relationship (which influences line thickness)