# N-Ary tree

**URL:** https://forum.kirupa.com/t/n-ary-tree/42116
**Category:** programming
**Created:** [February 5, 2004, 12:23pm UTC](https://forum.kirupa.com/t/n-ary-tree/42116 "2004-02-05T12:23:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Cruiser](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@Cruiser](https://forum.kirupa.com/u/Cruiser)
#### Post date: [February 5, 2004, 12:23pm UTC](https://forum.kirupa.com/t/n-ary-tree/42116/1 "2004-02-05T12:23:05Z")

</div>

Hi board,

I need to display a n-ary tree. Does anybody have an implementation or logic to position the various nodes?

The tree can be arbritrarily huge.

Currently the nodes are library - movieClips and added to the \_root using attachMovieClip and the connectors/edges are done using lines. The tree is not being displayed as of yet its just adding to nodes at random positions and drawing a line between them. ☹

Help. Any other stratergy to display the tree could also be used but the nodes should be draggable more precisely a node can be dragged and dropped into another node.

Thanks.

Cruiser.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 6, 2004, 9:31am UTC](https://forum.kirupa.com/t/n-ary-tree/42116/2 "2004-02-06T09:31:16Z")

</div>

Hoi

I would like to help but i dunno what you what to achieve.

maybe you can show what you all ready have 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 7, 2004, 5:49am UTC](https://forum.kirupa.com/t/n-ary-tree/42116/3 "2004-02-07T05:49:01Z")

</div>

Hi,

You would get a better idea if you see [http://www.touchgraph.com/PlanetWissen.html](http://www.touchgraph.com/PlanetWissen.html)

That is a 2d model but the nodes are all around. I want to do the same thing but the child nodes are always below the parent node. The physics aren’t necessary.

Thanks.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 8, 2004, 10:31am UTC](https://forum.kirupa.com/t/n-ary-tree/42116/4 "2004-02-08T10:31:15Z")

</div>

```auto

randomleeway = 10
spaceing = 20
this._x = (Math.random()*randomleeway-randomleeway/2)+ParentNode._x;
this._y = (Math.random()*randomleeway-randomleeway/2)+ParentNode._y+spaceing;

```

some thing like that?
