Neo4j is a graph database. In Neo4j, a graph is a collection of nodes and the relationships among them.
For example, above graph shows user ‘Ram’ information.
a. Ram works at uber
b. Ram stays in a rented house
c. Ram is father of Lava
d. Ram friends with Krishna
e. Ram lives in Delhi
Nodes in the graph
Ram, Uber, Rented House, Lava, Krishna, Delhi
Relationships in the graph
Works at, Stays at, Father of, Friends With, Lives in
When can I use neo4j?
If your data is highly interconnected, then you can go for neo4j.
Labels
Labels are used to group the nodes.
For example, all the nodes representing persons could be labelled with the label :Person. With that in place, we can ask Neo4j to perform operations only on your person nodes, such as finding all persons with a given name.
As you see above image, I labelled the nodes Ram, Lava and Krishna with :Person. Node Delhi is labelled with :City. Node Uber is labelled with :Org. Node Rented House is labelled with :House.
Properties
Properties are key-value pairs that are associated with a node or relationship.
For example, Node Ram can have below properties.
{
name: 'Ram',
age: 23,
height: "6ft"
}
Key points to note
a. Relationships in ne04j are unidirectional
b. A node can have self-relationships (relationship to self)
c. Neo4j do not support nested properties.
Previous Next Home
No comments:
Post a Comment