Neo4j - Data Model


Advertisements

Neo4j Property Graph Data Model

Neo4j Graph Database follows the Property Graph Model to store and manage its data.

Following are the key features of Property Graph Model −

  • The model represents data in Nodes, Relationships and Properties

  • Properties are key-value pairs

  • Nodes are represented using circle and Relationships are represented using arrow keys

  • Relationships have directions: Unidirectional and Bidirectional

  • Each Relationship contains "Start Node" or "From Node" and "To Node" or "End Node"

  • Both Nodes and Relationships contain properties

  • Relationships connects nodes

In Property Graph Data Model, relationships should be directional. If we try to create relationships without direction, then it will throw an error message.

In Neo4j too, relationships should be directional. If we try to create relationships without direction, then Neo4j will throw an error message saying that "Relationships should be directional".

Neo4j Graph Database stores all of its data in Nodes and Relationships. We neither need any additional RRBMS Database nor any SQL database to store Neo4j database data. It stores its data in terms of Graphs in its native format.

Neo4j uses Native GPE (Graph Processing Engine) to work with its Native graph storage format.

The main building blocks of Graph DB Data Model are −

  • Nodes
  • Relationships
  • Properties

Following is a simple example of a Property Graph.

Property Graph

Here, we have represented Nodes using Circles. Relationships are represented using Arrows. Relationships are directional. We can represent Node's data in terms of Properties (key-value pairs). In this example, we have represented each Node's Id property within the Node's Circle.

Advertisements