This weekend I had a few hours to spare, and for the lack of better things to do, I decided to node graphs in Python. I imagined it'd be fun (and I wasn't all that wrong!) and have as little boring theory as practically possible. *The second part wasn't all that true though.*

The first couple of hours were spent searching for a data visualization library (Javascript or Python) that didn't induce a seizure with high contrast colors, and was aesthetically pleasing.

Reluctant to use industry-level visualization libraries that required writing a lot of JS, I stuck to an option that 5 year old me absolutely loved — **Turtle**.

To be fair, this decision was largely impacted by the fact that Turtle came preinstalled with Python 2.7 on my Macbook.

One of the first things I realized was that Turtle involved writing commands (essentially just calling functions) and that was a little too ardous for my liking. So I decided to make shortcodes, and nested sets of operations under shorter function names, like this —

```
def fd(iteration, distance):
iteration.forward(distance)
def rt(iteration, distance):
iteration.right(distance)
def lt(iteration, distance):
iteration.left(distance)
def bk(iteration, distance):
iteration.right(180)
iteration.forward(distance)
```

That being done, I quickly make three turtles diverge from a point. The results were pretty straightforward.

These turtles would now have to generate two more turtles at their end-points, which would recursively scale the radial node graph.

```
def branch_and_move(iteration, num):
temp_pos = iteration.position()
temp_head = iteration.heading()
iteration.hideturtle()
x = jarvis.Turtle()
y = jarvis.Turtle()
i = random.random()
x.pencolor(random.random(), random.random(), random.random())
y.pencolor(random.random(), random.random(), random.random())
x.pensize(i)
y.pensize(i)
x.speed(0)
y.speed(0)
x.penup()
y.penup()
x.setpos(temp_pos)
y.setpos(temp_pos)
x.pendown()
y.pendown()
x.setheading(temp_head)
y.setheading(temp_head)
lt(x, num)
rt(y, num)
fd(x, 30)
fd(y, 30)
x.hideturtle()
y.hideturtle()
num = num/1.5
if num > 1:
branch_and_move(x, num)
branch_and_move(y, num)
else:
pass
```

This function allowed me to have control over parameters like the distance each turtle travelled from the mean point of the radial node graph and even the angle, all using the "num" argument.

Thus I could go from the very ordinary looking —

All the way to the "Holy crap, that's crowded!" —