You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3.9 KiB

Tree Maker

Tree sorting visualization and algorithmic publishing

Mara Karagianni in collaboration with Ahnjili ZhuParris

The initial ideas were about combining the concept of tree branches and the tree sort algorithm to map plants names, their year of publication, and including non-scientific content from online forums. The latter, we thought would bring some everyday narration to an otherwise very academic and abstract process of how trees are categorized and named, a methodology developed by Linnaeus in 18th century, amended and further developed in the International Code of Botanical Nomenclature, which entails the rules of plant naming. However its still considered biased as to the syntax and categorization followed.

Sorting tree algorithm can produce different types of traversals:

Depth First Traversals:

(a) Inorder (Left, Root, Right) : 4 2 5 1 3

(b) Preorder (Root, Left, Right) : 1 2 4 5 3

(c) Postorder (Left, Right, Root) : 4 5 2 3 1

Breadth First or Level Order Traversal : 1 2 3 4 5

DATASETS

more information about the datasets used during the residency please see here:
https://git.local.algoliterarypublishing.net/artnou/sortingtree

References

International Code of Botanical Nomenclature
python programming and tree traversals
video tutorial on the different traversals

Due to the very short window of implementation in terms of hands-on dataset definition and coding (2 days), we decided to visualize the tree layout with the level order traversal, since the depth first traversals, such as the pre-order traversal, requires a more complex calculations such as the logarithm of the surface, where the nodes of a tree shall be drawn on that surface. A pre-order traversal layout is to be considered when there is more time and resources to revisit the project and the code.

The layout output implements the sorting tree with python code and includes 16 methods for layout and generate pdf documents, and for debugging the code.

Code repository

Tree maker is a Python module, derived from PyFPDF, for tree like design layout It follows the logic of the zine maker by the same author mara karagianni Tree class and all its methods are defined in tree_maker.py
Tree methods can be called by the script tree_design.py

  1. Tree method keys_sorting:
    Soring with the class Node and Left and Right input nodes
  2. Tree method draw_year: Simple generating of year stamps in vertical position and progressively moving horizontally to the left side input data >> sorted years by the Tree keys_sorting method: trees/test_years_simple_layout.pdf
  3. Tree method design_tree: input data >> sorted years by the Tree keys_sorting method: trees/test_years_tree_layout.pdf
  4. Tree method draw_year_name: Year-name pair stamps in vertical position in a branching layout, work in progress input data >> sorted years by the Tree keys_sorting method:: trees/test_year_name_pair_layout.pdf
  5. Tree method draw_year_name_reddit (work in progress): branching sorted year followed by trees named that year on the left side and reddit blog titles related to those trees on the right side input data >> Dictionary of sorted years as keys, and a list of tree family names and tree scientific names as values. Intersecting with a dict of same tree family names as keys and tree family names as values.
    All pdf output experiments are under the trees folder

Example

To run the code, we need a Python 3 environment and to install PyFPDF Then we run from the terminal:

python tree_design.py

Inside the tree_design.py we can uncomment the method we would like to run, from line 100 to 103