https://github.com/cvzi/py_treedraw
Generate layout for drawing a tree in 2D. Based on the improved Walker Algorithm.
https://github.com/cvzi/py_treedraw
graph-algorithms graph-drawing level-based tree tree-drawing visualization
Last synced: about 1 year ago
JSON representation
Generate layout for drawing a tree in 2D. Based on the improved Walker Algorithm.
- Host: GitHub
- URL: https://github.com/cvzi/py_treedraw
- Owner: cvzi
- Created: 2017-07-20T10:14:18.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-09-08T20:40:10.000Z (almost 7 years ago)
- Last Synced: 2025-02-09T21:42:10.529Z (over 1 year ago)
- Topics: graph-algorithms, graph-drawing, level-based, tree, tree-drawing, visualization
- Language: Python
- Homepage: https://www.researchgate.net/publication/30508504_Improving_Walker%27s_Algorithm_to_Run_in_Linear_Time
- Size: 44.9 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
treedraw.py
===========

This module implements a layout algorithm for a tree.
Each node in the tree has a layout property that contains an x and y
coordinate.
The layout is calculated by calling the method "walker(distance)".
The distance property indicated the distance between nodes on the same level.
If the tree is build up using the addChild/removeChild methods, the layout
will be calculated in linear time _O(n)_.
The algorithm is a python implemenation of this publication ["Improving
Walker's Algorithm to Run in Linear Time"](http://citeseer.ist.psu.edu/buchheim02improving.html) by Christoph Buchheim, Michael Jünger, Sebastian Leipert.
Tested with Python 2.6, 2.7, 3.3, 3.4, 3.5, 3.6 and 3.7
The example code ([example.py](https://github.com/cvzi/py_treedraw/blob/master/example.py#L37-L92)) requires [pygame](https://www.pygame.org/wiki/GettingStarted) for the graphical interface.
[](https://travis-ci.org/cvzi/py_treedraw)
[](https://www.codacy.com/app/cuzi/py_treedraw?utm_source=github.com&utm_medium=referral&utm_content=cvzi/py_treedraw&utm_campaign=Badge_Grade)
[](https://coveralls.io/github/cvzi/py_treedraw?branch=master)