web gl ui creation .

Please give me an algorithm to create the following tree structure and auto positioning of child nodes given a parent node.