DEV Community

Chidera Stella Onumajuru
Chidera Stella Onumajuru

Posted on • Edited on

A Simple Guide to Graph Databases for Beginners.

In this blog post, I will be defining some key terms used in graph databases and what they actually mean. I will be using the picture below to explain all the terminologies, this picture was obtained from the Apache AGE viewer.

This is an image showing Nodes and Relationships in a graph database

The Apache AGE viewer is used to visualize the created graph database. To install the Apache Age viewer, this blog provides a very clear guide.

  • Vertices. A vertex in a graph database represents a single entity. A vertex is the basic entity of the graph, with the unique attribute of being able to exist in and of itself. A vertex may be assigned a label and a property. A vertex may have zero or more outgoing edges. A vertex may have zero or more incoming edges. In the picture above, I created three nodes with labels called Student and School, two of these nodes have the same label, that is the School node, but they all have different properties such as Chidera, Esther and Madonna as seen inside the circles. When I say node here, I mean a vertex. The nodes can be seen at the left-hand side of the picture with labels School and Student.

  • Edge. An edge is an entity that encodes a directed connection between exactly two nodes, the source node and the target node. Edges creates a connection between one vertex and another. An Edge is otherwise known as relationships and can have a property as well as a label. The Edges in the pictures above are AreClassmates and Attends, they are actually the line that connects two different nodes together. This line can be empty or given a name just like I did, these names given to it are the labels.

  • Properties. Properties are key-value pairs that are used for storing data on Vertex and Edges. The properties are actually not clearly being shown in the picture above, but the names inside the circles are the different properties each of the nodes have.

  • Label. A Label is a name or identifier to a Node or a Relationship. A Node or relationship may or may not have a label. Labels in the above picture are School,Student,AreClassmates and Attends.

  • References
    https://age.apache.org
    https://neo4j.com

Top comments (0)