I didn’t update the latest project in the amount of time I had planned on doing it due to, quite honestly, forgetting to do it because of work. I also realized that while I used to enjoy programming in R, and might still, I’d much prefer approaching this from the very start in C++. So, I’d like to go through some of my thoughts during the initial development of this project.

Ahriman’s Moon: Class Formulation

Graphical Representation

I want to begin by approaching this from a 2-dimensional view. We can construct a series of concentric circles of nodes quite easily. If we were to just want coordinates, then we could do the following for 25 nodes a circle with 3 circles.

vector<double> x;
vector<double> y;
float xVal = 0.0;
float yVal = 0.0;
int nodes = 25;
int circles = 3;

x.push_back(xVal);
y.push_back(yVal);

for (int i = 0; i < circles; i++) {
for (int j = 0; j < nodes; j++) {
xVal = (i+1.0) * cos((2.0*M_PI/nodes) * j);
yVal = (i+1.0) * sin((2.0*M_PI/nodes) * j);
x.push_back(xVal);
y.push_back(yVal);
}
}


We can print these for verification, but that’s not necessary. Below are the results in gnuplot. Note the usage of

$\cos\left(\frac{2\pi}{#\text{nodes}j}\right)$ and $\sin\left(\frac{2\pi}{#\text{nodes}j}\right)$

which provide the mathematical formulation of a circle. $i$ is used to specify the radius of the circle, where $j$ creates all the possile nodes by going from $0$ to $2\pi$, effectively.

So, we have a visual of circles of nodes in 2-dimensions. That being said, it isn’t very useful to have this picture. We need an actual graph, with actual connections between these nodes.

Class Construction

We can start with the basics. What do we need in each node as per our initial requirements and in order for us to be able to properly access the next ones?

Well, if we want to calculate any form of spacial distance, we need an $x$-coordinate and a $y$-coordinate. So, hypothetically, we could access each node by their coordinate! But, these coordinates can get nasty as well as have issues from rounding error with slight changes programmatically. Instead, I propose the following:

class Node {
private:
double _xCoor;
double _yCoor;
int _ringNo;
int _nodeId;
vector<Node*> _connList;
}


The above provides the coordinate variables as well as

• Ring No: So we can identify a node by the ring it is in
• Node ID: So we can identify where on the ring it is, starting from the 0th radian.
• Connection List: A vector of pointers to nodes that the current node is connected to.

That’s it for now! More to follow soon.