Search⌘ K
AI Features

Graphs

Explore the foundational concepts of graphs, including vertices, edges, and the distinctions between simple and non-simple graphs. Understand key terms like adjacency, incidence, and degree, and learn how graphs are represented without assuming geometric properties.

A graph and its constituent parts

Imagine some dots. Let’s give these dots a name—vertices. Now imagine some lines, each connecting one dot to another. Let’s call these edges. This structure we just built in our mind is an example of what we want to conceive as a graph.

An example of a graph
An example of a graph

Of course, we want a more precise definition, so we know exactly what constitutes a graph and what doesn’t.

A graph GG consists of a non-empty set VV, whose elements are called vertices, and a set EE, whose elements are called edges, such that each edge is associated with one or two vertices called its end-vertices.

We use the notation G=(V,E)G = (V, E) to highlight that VV is the vertex set and EE is the edge set of a graph GG.

A vertex can also be referred to as a node. An edge with only one end-vertex is called a loop or a self-loop.

Types of edges
Types of edges

Simple graphs

Some applications of graphs allow multiple edges between the same pair of vertices, while others allow loops. A graph without loops and with at most one edge appearing between any pair of vertices is called a simple graph. Graphs that are not simple are called non-simple graphs.

A simple graph (left) and a non-simple graph (right)
A simple graph (left) and a non-simple graph (right)

Convention: When the qualifier “simple” or “non-simple” is omitted, it is assumed that the graph is simple.

Notations for vertices and edges

  • We denote a vertex by a letter in lowercase, such as uu, vv, or ww. With many vertices, we prefer naming them by numbering them using subscripts v1,v2,,vnv_1, v_2, \ldots, v_n.

  • Likewise, we can denote an edge by a lowercase symbol like ee or e1,e2,,eme_1, e_2, \ldots , e_m.

    However, for simple graphs, we typically denote an edge by putting together, in any order, the names of its end-vertices. For instance, (u,v)(u,v) denotes an edge with end-vertices uu and vv. Clearly, (u,v)(u,v) and (v,u)(v,u) denote the same edge.

The notations (u, v) and (v, u) represent the same edge
The notations (u, v) and (v, u) represent the same edge

Adjacency, incidence, and degree

In the example below, see how vertices uu and vv are neighbors—in the sense that an edge joins them directly. Such pairs of vertices are said to be adjacent to each other.

Vertices u and v are adjacent
Vertices u and v are adjacent

Adjacent vertices are vertices having an edge joining them.

One more note on usage:

An edge is said to be incident on a vertex if that vertex is its end-vertex.

So, for example, the edge (u,v)(u,v) is incident on the vertex uu. It is also incident on the vertex vv.

The degree of a vertex is the number of edges incident on that vertex, except that each loop is counted twice.

The reason we count a loop twice is that we want the degree of a vertex to signify the number of ends of edges sticking out of that vertex.

Select a vertex in the following example to see its degree:

Graphs are not geometric figures

All the pictures we saw above may have created the illusion that the edges are line segments and are at specific angles to each other. However, that’s not true at all! Think back to the definition. The graph drawing is just a representation of the graph structure.

In fact, given a graph drawing, we can redraw the same graph by moving its vertices and edges around and changing the curvature of the edges.

Same graph drawn in three different ways
Same graph drawn in three different ways

Try dragging vertices to see different ways to draw the same graph: