# Distribute objects in Concentric Circles

I am attempting to distrubute objects evenly in concentric circles according to the following rules.

1. There will always be 1 object at the centre of the plane at $(0,0)$.
2. Each circle will have n elements which need to be distributed.
3. The number of each element in the circle is known as k.
4. The circles level, known as h, starts at 1 at the center object.
5. Every element has a parent, of which it has a direct relation. Each element should be at one level more than its parent.
6. No element shall have more than 1 parent, or be its own parent.
7. A parent may have 0 to many children.
8. With the exception of the first circle, each element should be distributed in respect to the elements parent to no more than half of its parent's angle.
• This image gives more context here but a way of explaining this is if each parent has a pie wedge, which is half way between it and k-1 and k+1, then each child element should sit between these two points.
9. The radius of the circles is known as r.

The purpose of this is to generate a hierarchy of people and who they report to in an organisation.

I can currently generate the second circle's distribution via the formula:

• x = Parent_x + r cos(2kπ/n)
• y = Parent_y + r sin(2kπ/n)

However, I am unsure as to how to proceed for h >= 3

• By "circle level" do you mean the labelling number of the circle ? – Jean Marie Sep 11 '17 at 7:59
• I have taken the liberty to replace the tag "linear algebra" (no connection here with vector, matrices, linear spaces...) by "graph theory" : your graph here is in fact a tree. – Jean Marie Sep 11 '17 at 8:03
• Thus, you have a (abstract, i.e., computer science) "tree structure" and you want a (concrete, graphical) "harmonious blossoming" structure to render it. Could we say that a first approach would be to define circle sectors, centered at the origin in such a way that any "parent" at any level of the tree "has" his/her descendants in this sector ? – Jean Marie Sep 11 '17 at 8:21

Seems like this hierarchical structure is a rooted tree. So will be using graph theory notation.

One possible way of approaching this is to allocate a sector for each node. That is, allocate sector $(0,2\pi)$ for the root. From here on, it should just be a matter of allocating the right sector to each vertex.

Let $v$ be a vertex that has been allocated a sector, call it $(a_v,b_v)$. Suppose $v$ has $k$ children $\{v_0,v_1,\ldots,v_{k-1}\}$. Assign sector $$\left(a_v+\frac{(b_v-a_v)i}{k},a_v+\frac{(b_v-a_v)(i+1)}{k}\right)$$ to $v_i$.

This should define a sector for each vertex of the tree. Now, to actually compute coordinates for each vertex, let $v$ be a vertex of the tree and let $d$ be the distance from the root to $v$. The coordinates for $v$ should be $$dh\left(\cos\left(\frac{a_v+b_v}{2}\right),\sin\left(\frac{a_v+b_v}{2}\right)\right),$$ where $h$ is the increase in the radius of two consecutive circles.

Here is an example of the kind of layout this generates. Is this something like what you had in mind? Could you possibly be looking for the "radial layout" of a tree? Was reminded of that term after trying to come up with a name for the image ;-)