This repository contains a small, compact drawing algorithm for k-ary trees, implemented in Python3. The root will be drawn at first, afterwards, the drawing algorithm proceeds to draw all the children up to a specific level, placed on grid points. This visualization has the property to keep the edge lengths uniform, creating a straight-line drawing of uniform length straight-lines apart a rounding error.
python3 preinstalled with packages networkx and matplotlib
pip install -r requirements.txt
Exemplary execution of a tertiary tree of height 4
python ./k-ary_tree_drawer.py -k 3 -he 4 -c -i
Without arguments, the code defaults to setting k=2, h=3