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.
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
:= NBDS_AXON | NBDS_NEURON | NBDS_ROUTE
:= NBDS_ID | NBDS_NAME | NBDS_ATTR | NBDS_USED | NBDS_DESC
:= NBDS_FROM | NBDS_TO
:= NBDS_AXONS | NBDS_NEURONS | NBDS_ALL
:= NBDS_IS | NBDS_LIKE | NBDS_BETWEEN | NBDS_IN
:= string | numeric
:= string | numeric
, , )
The Get-operation performs a simple get request on the network. The
, , , , )
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)
, , )
To route through the network, from point
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
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.