---
# System prepended metadata

title: Graph Database

---

# Graph Database

[Source](https://neo*.com/)

## What is a Graph Database

Graph database is a database that uses `graph strutures` to represent and store data
It uses nodes to store entities, edges to store relationship

![](https://d*awsstatic.com/diagrams/foaf-graph.e*****e*a**f**d*f**f*a**.png)


## Graph Data Modeling

### Nodes

* Nodes are often used to represent entities
* Nodes can contain properties that hold name-value pair of data and can be assigned roles or types using one or more labels

![](https://dist.neo4j.com/wp-content/uploads/modeling_johnsally_nodes.jpg)

### Labels

* Label is a named graph construct that is used to group nodes into sets
*  A node can be labeled with any number of labels
*  Labels make queries easier to write and more efficient

![](https://dist.neo4j.com/wp-content/uploads/modeling_johnsally_labels.jpg)

### Relationships

* A relationship connects two nodes and allows us to find related nodes of data

![](https://dist.neo4j.com/wp-content/uploads/modeling_johnsally_relationships.jpg)

### Properties

* Properties are name-value pairs of data that you can store on nodes or relationships

![](https://dist.neo4j.com/wp-content/uploads/modeling_johnsally_properties.jpg)

## When to use Graph Database

### Is Data Highly-Connected?

If the connections within the data are not the primary focus or the graph is sparsely connected, then graph database is not the best fit.

### Is Retrieving the Data more Important than Storing it?

Graph databases are optimized for data retrieval.
A good rule of thumb is, if you don’t intend to use JOIN operations in your queries, then a graph is not a must-have.

### Does Data Model Change Often?

If your data model is inconsistent and demands frequent changes, then using a graph database might be the way to go. Because graph databases are more about the data itself than the schema structure, they allow a degree of flexibility.



## Language
[Cypher](https://neo4j.com/developer/cypher/intro-cypher/): Neo4j's graph query language