Data Model

Graph

Neo4j uses a Graph data model.

../_images/Neo4j-DataModel.svg

Comparison

  • If one takes the stack of rows stored in RDBMS tables, separate the rows as individual nodes and keeps the relationships, the data becomes visible as a graph.
  • A Column-Family database uses families to group rows.
  • When stored in a graph the families can become hierarchical.
  • A document store can be seen as a graph, by asking what is the relationship between a field of the document and the document ?
  • When the values have Keys themselves, the underlying structure is the one of a graph.

Internals

You don’t need to read this section if you are only interested in using Neo4j in an application.

But if you are curious about how Neo4j does the internal magic, you may find this interesting.

The internal storage of Neo4j uses a double-linked-list data structure.

The content of these data structures is stored the following collection of files:

  • /var/lib/neo4j/data/graph.db/neostore
  • /var/lib/neo4j/data/graph.db/neostore.id
  • /var/lib/neo4j/data/graph.db/neostore.nodestore.db
  • /var/lib/neo4j/data/graph.db/neostore.nodestore.db.id
  • /var/lib/neo4j/data/graph.db/neostore.propertystore.db
  • /var/lib/neo4j/data/graph.db/neostore.propertystore.db.arrays
  • /var/lib/neo4j/data/graph.db/neostore.propertystore.db.arrays.id
  • /var/lib/neo4j/data/graph.db/neostore.propertystore.db.id
  • /var/lib/neo4j/data/graph.db/neostore.propertystore.db.index
  • /var/lib/neo4j/data/graph.db/neostore.propertystore.db.index.id
  • /var/lib/neo4j/data/graph.db/neostore.propertystore.db.index.keys
  • /var/lib/neo4j/data/graph.db/neostore.propertystore.db.index.keys.id
  • /var/lib/neo4j/data/graph.db/neostore.propertystore.db.strings
  • /var/lib/neo4j/data/graph.db/neostore.propertystore.db.strings.id
  • /var/lib/neo4j/data/graph.db/neostore.relationshipstore.db
  • /var/lib/neo4j/data/graph.db/neostore.relationshipstore.db.id
  • /var/lib/neo4j/data/graph.db/neostore.relationshiptypestore.db
  • /var/lib/neo4j/data/graph.db/neostore.relationshiptypestore.db.id
  • /var/lib/neo4j/data/graph.db/neostore.relationshiptypestore.db.names
  • /var/lib/neo4j/data/graph.db/neostore.relationshiptypestore.db.names.id

The filenames are self-descriptive of their content.