Menu

1 / 5

Graph Databases: When Relationships Are the Data

DEV Community: backend·Abdeldjalil Chougui·about 16 hours ago
#CHvpunrA
#devtobackend#devto#dev#graph#name
Long article (1245 words) — no AI summary yet.
Reading 0:00
15s threshold

Some questions are about things: "what is this user's email?". Others are about connections: "which people does Sara know through at most three introductions?", "which accounts share a phone number with an account flagged for fraud?", "what depends on this package, directly or indirectly?". Relational databases answer the first kind very well. For the second kind, where the path between records is the answer, a graph database is often the better fit.

The property graph model

Most graph databases, such as Neo4j, Memgraph and Amazon Neptune, use the property graph model:

Nodes are the entities: a person, a company, a product. A node has one or more labels ( Person , Company ) and properties (key and value pairs, like name: "Sara" ).

Relationships (edges) connect two nodes. Each has a type ( KNOWS , WORKS_AT , BOUGHT ), a direction, and can have its own properties ( since: 2021 ).

The key point: relationships are stored as first-class data, not computed at query time.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.