In this post..
I hope to set down some details reagarding Neo4J, this is hopefully the first in a collection of posts regarding this tool
An introductory article to Neo4j
Neo4j is an open source NoSQL graph database. It can be up to 100 000 times faster than a relational database in certain circumstances.
The theory
The theory is that you have a bunch of nodes, and then you create links between each node (Relationships) and on these relationships you can store properties and values (Key-value pairs).
A use case for this could be that you have four bus stops as shown below. A, B, C and D. What you want to find out is the cheapest way to get from A to D.
To me and you this would seem particularly simple A - B, B - D would only cost £7. A - C, C - D £12 but in terms of a relational database you would probably take quite an extensive data model, and a processor heavy SQL query to find this out. For Neo4J, we would create 4 nodes. A B C and D, and then create relationships between these. The relationship between each station would have a property of cost associated with it. We could then use Neo4J's traversing model to find the shortest path (Cost) between the stops.

No comments:
Post a Comment