Hello everyone, today I want to introduce to you the Neuron Based Data Structure (so called NBDS). Recently, I often dealt with the topic of medicine and the similarities to computer science. What can computer sciencists learn from medicine and nature?The answer is: Very much! Well, nearly everything that we have developed was originally inspired by nature. That is why I decided to build a data structure that looks like a neural network. From some points of view, it isn’t really a neural network, but just a network with relationships between the vertexes, anyway I called the vertexes neurons and named the edges axons. But what is the idea for this network structure? In this article, i will explain how to use it.

How it is structured (SNA)


The Space is the master class. It includes all neurons and axons of the network. You can add, edit and remove axons/neurons with methods of the Space class. The Space is the class, which performs your queries to the networks like get, select, route etc. I tend to give the Space the power to capture some statistical data about the network. For example to store routing information.


The neuron class is used like a container for some data. It has an unique ID, a name, attributes, a value and an used-counter, which captures the number of times this neuron was affected by queries and so on. This class represents the data in the network. We can say, that this container is some kind of a meta-variable (or object). You can also store data-about-data with the attributes-array. And you can use this attributes-array to store information about the neuron.


The axon class represents the relationship of the data in the network. You can use an axon to add a logical connection between two neurons. If you connect two neurons with an axon, it shows that the data of these two neurons have a relationship to each other. To explain the relationship, this axon has an attribute called description. It also has an unique ID, a name, a description, a value, an attributes array to specify the attributes of the relationship, stores the unique ID’s of the two neurons that it connects. These two neurons were stored in neuron_from and neuron_to. Another attribute specifies whether this axon works bi-directional or one-directional.

structure of the nbds

Querying the network

With no ability to perform operations on this network, it would be senseless to use it. That is why I thought about some operations that you can execute on the network. But  which operations make sense?

Constants & Definitions

 := string | numeric
 := string | numeric

Get( , , )

The Get-operation performs a simple get request on the network. The parameter in this case should be a constant, for instance NBDS_AXON if you want to get an axon back which exists between neuron and neuron . As you can see above, I tend to work with many other constants to perform requests.

Select(, , , , )

A Select-Command has a bit more complexity. It works like the  SQL-based version of the select statement. In this case we don’t execute our queries on tables – instead we use a network. But stored in an array, this neurons and axons have some similiarities with tables. So I decided to implement a Select-Command that returns a result set. (Get() returns just one object)

Route(, , )

To route through the network, from point to point you can use the Route-operation. In some cases it is useful to get the information that is linked between some neurons. It’s a bit tricky to perform this task, because routing- & search-algorithms are expensive. After some experiments I have decided to use some kind of a BFS (breadth-first search) algorithm. But why did I choose this one? The experiments I did on testing some algorithms like Flyod-Warshall, Dijkstra’s algorithm,  Bellman-Ford, Breadth-First-Search and Depth-First-Search were time expensive – but course informative. As you can see at this link (from Stony Brook University / Dep. of Computer Science) Breadth-First-Search acts more than a spider. Unlike Dept-First-Search (DFS) it scans the neighborhood of the start-neuron and afterwards goes deeper into each node. I think that BFS makes more sense, because the data that is related to a neuron, must lie in the near of this neuron. So, we must scan all the neighbors of this neuron, before we go deeper into the children of each neigbhour.

Algorithms like Flyod-Warshall, Dijkstra and Bellmann-Ford have to much intelligence to deal with this task in an acceptable amount of time. The BFS-algorithm used in this network works as simple (and smooth) as possible.

You can control the behavior of Route() with some that i will describe later on.


Now, i will explain some use cases of the neuron-based-data-structure. For web applications this structure isn’t so suitable, because web servers have to respond fast and secure. In most cases web-based systems keep their logic in the database. This concept works the other way around. In some cases you need a relationship between two data types. For instance you can implement a registry with the singleton-pattern to access objects in all layers of your application. I think it is useful to implement this network structure into such registry. Below, I will list some use cases for this structure (NBDS)  in web-based systems:

  • Intelligence in Registry-structure (singleton-based implementation)
  • Reflect relationships between users with attributes
  • Generate FOF (New Galaxy Group Finding Algorithm) dependencies
  • Reflect relationships to perform requests and get the usage counter to see which neuron is the most important node
  • Put the result of database queries into the network to keep up the relationships between tables or rows
  • Alternative paradigma of generating a page (all neurons that where hit during a Route()-operation must be displayed/responded)

The second part of the example section deals with hardcoded programs or desktop applications. For this kind of applications it is not so tricky to decide whether we must serve with highspeed or not. The reason of this attitude is, that this applications were compiled.  That’s a great benefit for us, because we can use this structure for nearly all data that we need in our program. We can build relations between 2 objects, for instance to display this relations and decorate it with some attributes that we’ve defined before.

  • Generate a network of cities with attributes and and streets between it (also with attributes) (simulate traffic with the Route()-Op.)
  • FOF algorithms
  • To describe connections between data types, for instant just with a pointer


To sum up, I have to say that the idea of connecting 2 variables (or even objects)  isn’t new, but i didn’t find any implemention of this idea.  To explore some opportunities of building a data structure, it was a very helpful process to think about this idea. I have implemented this idea in PHP, because I’m very familiar with this language and it works simply. When I have finished the code and the documentation I will post it on the blog. See the project page of NBDS for more information.