What Is a Graph Database? Querying Connected Data by Following Relationships
A graph database stores entities and their relationships as central parts of its data model, so queries can follow links to find connected things. If your main question involves several steps—such as person, account, and device—you can represent which nodes connect and through which relationships. “Graph database” does not name one product or one data model, however; distinguish implementations such as property graphs and RDF.
What makes up a graph?
The familiar property graph consists of nodes, relationships, and properties. Nodes represent entities such as people, products, or accounts; relationships represent meaningful links between two nodes. Both nodes and relationships can have properties. For example, a person node might have a name, while a PURCHASED relationship might record a time or quantity. In Neo4j’s property graph, a relationship has a start node, an end node, a direction, and one relationship type.
Because the model stores links explicitly, path queries are natural: “which devices connect to this account?”, “which accounts share a device?”, or “which merchants did those accounts transact with?” But having many connections does not mean every dataset belongs in a graph. If the main questions are simple tabular aggregates, such as totals by account or date, relational tables or an analytical store may be more direct.
How do you express a query that follows relationships?
Imagine, as a hypothetical example, a transaction-review system that needs to find other accounts using a device in common with one account, and the merchants those accounts paid. A property graph could contain Account, Device, and Merchant nodes connected by USED and PAID relationships. The following illustrative example shows a Cypher pattern query:
MATCH (a:Account {id: 'A-17'})-[:USED]->(d:Device)<-[:USED]-(other:Account)
MATCH (other)-[:PAID]->(m:Merchant)
RETURN DISTINCT other.id, m.name;The pattern starts at account A-17, follows a device, finds other accounts that used it, and returns merchants those accounts paid. It does not determine risk or prove fraud. A device can be shared by family members or used on a public network, so one shared device is not enough to label an account suspicious. Any scoring or action needs time context, additional evidence, and a review process. This code was not executed.
Neo4j’s Cypher declares graph patterns in a MATCH clause to find matching node-and-relationship paths. RDF, by contrast, expresses a fact as a subject-predicate-object triple; an RDF graph is a set of such triples. Both represent relationships, but their data models, identifier handling, query languages, and reasoning capabilities differ. RDF data does not automatically work with property-graph queries unchanged.
What data fits, and what should you consider?
Graphs can suit problems where the path itself matters, such as recommendation connections, permission inheritance, supply-chain dependencies, data lineage, or fraud investigation. In these cases, “through which connections did we reach this entity?” may matter more than a flat result list. Conversely, if relationships are fixed and most requests are single-key lookups or simple aggregates, the additional graph modeling may add complexity without enough benefit.
Define what each node and relationship means, including direction, type, and whether duplicate links are meaningful. Indexes or constraints may help locate starting nodes quickly; broad or deep traversals can visit more data than expected. Plan traversal-depth limits, relationship-type filters, time windows, and result bounds, then verify them against real query plans and data distributions. Graph products differ in storage, distribution, transactions, and reasoning support.
Choose based on relationship complexity and the questions you repeatedly ask. A general database may be simpler when most questions ask “what is this record’s value?” A graph query may express the work more directly when you repeatedly ask “by what paths are these entities connected?” Model representative queries on a small sample, confirm that intended links are represented and unintended paths are not created, then evaluate integrity and performance at operational scale.
Sources and scope
[Neo4j: Graph database](https://neo4j.com/docs/getting-started/graph-database/)
[Neo4j Cypher Manual: Patterns](https://neo4j.com/docs/cypher-manual/current/patterns/)
[W3C: RDF 1.1 Concepts and Abstract Syntax](https://www.w3.org/TR/rdf-concepts/)
Neo4j’s official documentation and the W3C RDF 1.1 specification were checked on 2026-11-22. The property-graph details here are specific to Neo4j and are not generalized to every graph database. The Cypher and account-device query are hypothetical examples; they were not executed or validated as evidence of actual misconduct.