Tree plotting in Python

I want to plot trees using Python. Decision trees, Organizational charts, etc. Any library that helps me with that? Answer I develop ETE, which is a python package intended, among other stuff, for programmatic tree rendering and visualization. You can create your own layout functions and produce custom tree images: It has a focus on … Read more

Hitting Maximum Recursion Depth Using Pickle / cPickle

The background: I’m building a trie to represent a dictionary, using a minimal construction algorithm. The input list is 4.3M utf-8 strings, sorted lexicographically. The resulting graph is acyclic and has a maximum depth of 638 nodes. The first line of my script sets the recursion limit to 1100 via sys.setrecursionlimit(). The problem: I’d like … Read more

The best way to calculate the height in a binary search tree? (balancing an AVL-tree)

I’m looking for the best way to calculate a nodes balance in an AVL-tree. I thought I had it working, but after some heavy inserting/updating I can see that it’s not working correct (at all). This is kind of a two-part question, the first part would be how to calculate the height of a sub-tree, … Read more

Statistical performance of purely functional maps and sets

Given a data structure specification such as a purely functional map with known complexity bounds, one has to pick between several implementations. There is some folklore on how to pick the right one, for example Red-Black trees are considered to be generally faster, but AVL trees have better performance on work loads with many lookups. … Read more

What type of NoSQL database is best suited to store hierarchical data?

What type of NoSQL database is best suited to store hierarchical data? Say for example I want to store posts of a forum with a tree structure: original post + re: original post + re: original post + re2: original post + re3: original post + re2: original post Answer MongoDB and CouchDB offer solutions, … Read more

How to search JSON tree with jQuery

I have a question about searching the JSON for the specific information. For example, I have this JSON file: { “people”: { “person”: [ { “name”: “Peter”, “age”: 43, “sex”: “male” }, { “name”: “Zara”, “age”: 65, “sex”: “female” } ] } } My question is, how can find a particular person by name and … Read more