# Basic Graphs: An Introduction

# Basic Graphs: An Introduction

Join the DZone community and get the full member experience.

Join For Free**MariaDB TX, proven in production and driven by the community, is a complete database solution for any and every enterprise — a modern database for modern applications.**

The purpose of this post is to give a common footing for those reading to understand what I mean when I talk about a "graph". The field of graph theory is a very deep and well-explored one. The real trick here is trying to give an introduction to graphs and graph theory without getting lost in too much detail. I will endeavour to keep this post to the utter, simplified basics of graphs.

- 6 vertices or nodes (the circles), and,
- 7 edges or relationships (the lines between the circles).

**graph**consists of a series of

**vertices**or

**nodes**that can be connected via

**edges**or

**relationships**. These

**edges**can be

**undirected**or

**directed**.

**"Likes" graph**). Try to think of other information you could represent in graph fashion.

**tree**is actually a type of graph that is

**directed**and

**acyclical**(meaning that there are no loops, i.e. if you start following the directions on a graph, you travel each node exactly once).

**Weight**is another concept we come across in graph theory and graph databases. Think of

**weight**as being how important or strong a

**relationship**is between two

**nodes**. For example, a higher weight can imply a stronger

**relationship**between two

**nodes**representing, say, two friends.

**path**or least costly

**path**between two

**nodes**. (See an explanation of

**paths**further below.)

**degree**, which represents the number of

**edges**attached to a

**node**. So, a

**node**with a high

**degree**will be one that has a lot of

**relationships**attached to it. This can be very useful for determining just how popular, for example, something or someone is. (Cue jokes for this blog.)

**walk**or

**traversal**. A

**traversal**is taken to be the resultant

**path**found by starting at a node X and following to some other node on the graph Y and the

**edges**and

**nodes**visited during the trip from X to Y. This concept becomes important as we start to look in to graph-based databases as traversals are part of what we can use to extract useful information from a graph (e.g. "Who are all of my cousins?") and to even predict and recommend a product for someone based on their browsing history.

**MariaDB AX is an open source database for modern analytics: distributed, columnar and easy to use.**

Published at DZone with permission of Duncan Brown , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

## {{ parent.title || parent.header.title}}

## {{ parent.tldr }}

## {{ parent.linkDescription }}

{{ parent.urlSource.name }}