↓ Skip to main content

Definitions and Notation in Graph Theory

·3047 words·15 mins·
 Author
Author
Francisco Bustamante
Chemist, data scientist and Python programmer.
Table of Contents
The Mathematics of Connections - This article is part of a series.
Part 3: This Article

Before exploring the deep results of graph theory, we need to build a precise vocabulary. Like any area of mathematics, graph theory has specific definitions that let us communicate ideas clearly and without ambiguity.

In this article, we establish the formal language we will use throughout the series.

Why Do We Need a Formal Language?
#

Without a shared vocabulary, communication in graph theory would be imprecise and ambiguous. A formal language is indispensable for at least four reasons:

  • Modeling: real problems (computer networks, delivery routes, dependencies between tasks) can only be analyzed mathematically after they are translated into a graph with precise definitions.
  • Communication: when two researchers say “neighborhood of \(v\)”, the definitions guarantee that both understand exactly the same set.
  • Proofs: without rigorous definitions, proofs lose their validity; every step of a proof rests on the exact definition of the terms used.
  • Implementation: the formal definitions directly guide the data structures (adjacency lists, incidence matrices) that graph algorithms use.

These concepts have direct counterparts in computing: the neighborhood \(N(v)\) is exactly the adjacency list used in algorithms such as Breadth-First Search (BFS) and Depth-First Search (DFS); cliques are the core of community detection algorithms in social networks; and independent sets underlie the graph coloring problem, in which adjacent vertices cannot receive the same color, a restriction present in task scheduling, radio frequency allocation, and much more.

Formal Definition of a Graph
#

Simple Graph

A simple graph, or graph, \(G\) is a pair \((V, E)\), denoted \(G = (V, E)\), where \(V\) is a finite nonempty set of elements called vertices (also called nodes or points) and \(E\) is a set of unordered pairs of distinct elements of \(V\), called edges.

Notation conventions
  • Vertices = nodes = points: the three terms are synonyms.
  • Number of vertices of \(G\): \(|V(G)| = n\).
  • Number of edges of \(G\): \(|E(G)| = m\).
  • When there are several graphs \(G_1, G_2, \ldots, G_k\), we denote their vertex and edge sets respectively by \((V(G_1), E(G_1))\), \((V(G_2), E(G_2))\), …, \((V(G_k), E(G_k))\).
  • Graphs = simple graphs: unless stated otherwise, “graph” always means simple graph in this series.

Given a graph \(G = (V, E)\), each edge \(e \in E\) will be denoted by the pair \(e = (v, w)\) that forms it, with \(v, w \in V\). In this case, the vertices \(v\) and \(w\) are the endpoints of the edge \(e\). The edge \(e\) is said to be incident to the vertices \(v\) and \(w\).

Example 1

Let \(G = (V, E)\) with:

$$V = \{a,\ b,\ c,\ d,\ e\}$$

$$E = \{(a,b),\ (b,c),\ (a,c),\ (a,e),\ (c,d),\ (e,d)\}$$

In this graph:

  • \(a\) and \(b\) are adjacent; \(b\) and \(d\) are not adjacent
  • The edge \((c,d)\) is incident to \(c\) and to \(d\); the endpoints of \((c,d)\) are \(c\) and \(d\)
  • \(n = |V| = 5\) and \(m = |E| = 6\)

The figure below shows the geometric representation of \(G\).

Graph G of Example 1 with 5 vertices and 6 edges
Example 1: graph G

Geometric Representation
#

The usual way to represent a graph is geometric (in the plane): each vertex corresponds to a point in the plane and each edge \((v, w)\) corresponds to a line joining the points that correspond to the vertices \(v\) and \(w\).

Example 2

Let \(G\) be the graph of Example 1, with \(V = \{a,b,c,d,e\}\) and \(E = \{(a,b),(b,c),(a,c),(a,e),(c,d),(e,d)\}\). This graph admits multiple valid geometric representations: the vertices can be placed at different positions in the plane (for example, in the shape of a pentagon or in any other configuration), as long as the connections are preserved. The geometric representation of a graph is not unique.

The two representations below correspond to the same graph \(G\): same vertices, same edges, different positions.

Two drawings of the same graph G: pentagonal layout and layout with crossings
Example 2: two representations of the same graph

Multigraphs

If we relax the definition of a simple graph to admit equal unordered pairs of distinct elements of \(V\), called parallel edges, and pairs of equal elements \((v, v)\), called loops, we obtain a multigraph. In this series, unless noted otherwise, we work only with simple graphs.

Example 3

Let \(G = (V, E)\) with \(V = \{a, b, c, d\}\) and

$$E = \{(a,b),\ (a,b),\ (b,c),\ (c,d),\ (d,a),\ (c,c)\}$$

The two occurrences of \((a,b)\) are parallel edges; \((c,c)\) is a loop.

The multigraph below illustrates parallel edges and a loop.

Multigraph with parallel edges between a and b and a loop at c
Example 3: multigraph

Neighborhood and Isolation
#

Neighborhood

Let \(G = (V, E)\) be a graph. The vertices \(v\) and \(w \in V\) are said to be adjacent or neighbors if \((v, w) \in E\). We call the adjacency or neighborhood of \(v\) in \(G\) the set:

$$N(v) = \{w \in V \mid (v, w) \in E\}$$

When more than one graph is at play, we write \(N_G(v)\) to indicate the neighborhood of \(v\) in the graph \(G\).

Example 4

Let \(G\) be the graph of Example 1. We compute the neighborhood of each vertex:

  • \(N(a) = \{b, c, e\}\)
  • \(N(b) = \{a, c\}\)
  • \(N(c) = \{b, a, d\}\)
  • \(N(d) = \{c, e\}\)
  • \(N(e) = \{a, d\}\)

The following figure shows \(G\) with the vertex \(a\) and its edges highlighted, illustrating \(N(a) = \{b, c, e\}\).

Graph G with vertex a and its neighborhood highlighted
Example 4: neighborhood N(v) for each vertex

A vertex \(v\) with \(N(v) = \emptyset\) is called an isolated vertex, since it is not connected to any other vertex.

Example 5

Let \(G = (V, E)\) with \(V = \{1, 2, 3, 4, 5\}\) and

$$E = \{(1,2),\ (2,3),\ (1,3),\ (1,4),\ (3,4)\}$$

We compute \(N(5) = \emptyset\). Hence, 5 is an isolated vertex in \(G\).

Vertex 5 (highlighted) has no incident edges, confirming \(N(5) = \emptyset\).

Graph with isolated vertex 5, with no edges
Example 5: isolated vertex

A vertex \(v\) of \(G\) is said to be universal when

$$N(v) = V - \{v\}$$

that is, \(v\) is adjacent to all the other vertices of the graph.

Example 6

Let \(G = (V, E)\) with \(V = \{1, 2, 3, 4, 5\}\) and

$$E = \{(1,2),\ (1,3),\ (1,4),\ (1,5),\ (2,3),\ (3,4),\ (4,5)\}$$

We compute \(N(1) = \{2, 3, 4, 5\} = V - \{1\}\). Hence, 1 is a universal vertex in \(G\).

Vertex 1 (highlighted) is connected to all the others: \(N(1) = V - \{1\}\).

Graph with universal vertex 1 connected to all other vertices
Example 6: universal vertex

Isolated and universal do not coexist

In a graph with at least two vertices we cannot have an isolated vertex and a universal vertex at the same time: the universal vertex would be a neighbor of the isolated one, which by definition has no neighbors. The exception is the single-vertex graph, in which \(N(v) = \emptyset = V - \{v\}\) and the vertex is both.

The flowchart below summarizes how to classify any vertex \(v\) as isolated, universal, or neither.

flowchart TD
    A["Vertex v in G"] --> B{"N(v) = ∅ ?"}
    B -- "Yes" --> C["Isolated
no neighbors"] B -- "No" --> D{"N(v) = V − {v} ?"} D -- "Yes" --> E["Universal
adjacent to all"] D -- "No" --> F["Neither isolated
nor universal"]

The Complement Graph
#

Complement Graph

The complement of \(G\), denoted \(\bar{G}\), is the graph with the same vertex set \(V(G)\), such that two distinct vertices are adjacent in \(\bar{G}\) if and only if they are not adjacent in \(G\):

$$V(\bar{G}) = V(G)$$

$$E(\bar{G}) = \{(v, w) \mid v, w \in V(G)\ \text{and}\ (v, w) \notin E(G)\}$$
Example 7

Let \(G\) be the graph of Example 1: \(V = \{a,b,c,d,e\}\) and \(E(G) = \{(a,b),(b,c),(a,c),(a,e),(c,d),(e,d)\}\).

The complete graph on 5 vertices would have \(\binom{5}{2} = 10\) edges. Since \(m = 6\), the complement \(\bar{G}\) has \(10 - 6 = 4\) edges, exactly the pairs that do not appear in \(G\):

$$E(\bar{G}) = \{(a,d),\ (b,d),\ (b,e),\ (c,e)\}$$

The two graphs below illustrate \(G\) and \(\bar{G}\): note that the edges present in one are absent from the other.

Graph G with 6 edges next to its complement with 4 edges
Example 7: G and its complement

Subgraphs
#

One of the most important notions is that of a subgraph: parts of a graph obtained by keeping a subset of its vertices and edges.

Subgraph

Let \(G\) and \(H\) be graphs. \(H\) is said to be a subgraph of \(G\), denoted \(H \subseteq G\), if:

  • \(V(H) \subseteq V(G)\)
  • \(E(H) \subseteq E(G)\)
Example 8

Let \(G\) and \(H\) be the following graphs:

\(V(G) = \{a, b, c, d, e\}\),

\(E(G) = \{(a,b),\ (b,c),\ (a,c),\ (c,d),\ (e,d),\ (a,e)\}\)

\(V(H) = \{a, b, c, d\}\), \(E(H) = \{(a,b),\ (b,c)\}\)

Since \(V(H) \subseteq V(G)\) and \(E(H) \subseteq E(G)\), we conclude that \(H\) is a subgraph of \(G\).

The figure shows \(G\) on the left and \(H\) on the right. Note that \(H\) has only 2 of the 6 edges of \(G\), and the vertex \(d\) is isolated in \(H\).

Whole graph G on the left and subgraph H with 2 edges on the right
Example 8: subgraph H of G

Induced Subgraph
#

Induced Subgraph

Let \(G\) be a graph and \(A \subseteq V(G)\), that is, a subset of the vertices of \(G\). The subgraph of \(G\) induced by \(A\), denoted \(G[A]\), is defined by:

$$V(G[A]) = A$$

$$E(G[A]) = \{(x, y) \in E(G) \mid x \in A\ \text{and}\ y \in A\}$$

\(G[A]\) inherits all the edges of \(G\) whose two endpoints belong to \(A\).

Example 9

Considering the graph \(G\) of Example 8, let \(A = \{a, b, c, d\}\) (\(A \subset V(G)\)). The subgraph \(F = G[A]\) induced by \(A\) has:

\(V(F) = \{a, b, c, d\}\)

\(E(F) = \{(a,b),\ (b,c),\ (a,c),\ (c,d)\}\)

Observe that \((a,c)\) and \((c,d)\) belong to \(E(F)\) because both endpoints of each of these edges belong to \(A\) and they exist in \(E(G)\).

In the figure, the vertices of \(A\) are highlighted in \(G\) (left); on the right, \(F = G[A]\) with all 4 inherited edges.

G with set A highlighted and induced subgraph F on the right
Example 9: induced subgraph F = G[A]

Subgraph ≠ Induced Subgraph

The subgraph \(H\) of Example 8 and the subgraph \(F\) of Example 9 have the same vertex set \(\{a,b,c,d\}\), but they are not equal:

  • \(E(H) = \{(a,b),\ (b,c)\}\): \(H\) is not the subgraph of \(G\) induced by the set \(\{a,b,c,d\}\), because the edges \((a,c)\) and \((c,d)\) exist in \(G\) with both endpoints in \(\{a,b,c,d\}\), but were omitted from \(H\).
  • \(E(F) = \{(a,b),\ (b,c),\ (a,c),\ (c,d)\}\): \(F\) is an induced subgraph because it inherited all the edges of \(G\) among the vertices of \(A\).

The comparison below places \(G\), \(H\), and \(F\) side by side: \(H\) and \(F\) have the same \(V\), but \(H\) omits edges that \(F\) necessarily inherits.

G, H (subgraph), and F (induced subgraph) side by side for comparison
Comparison: subgraph vs induced subgraph

Spanning Subgraph
#

Spanning Subgraph

Let \(G\) and \(H\) be graphs. \(H\) is said to be a spanning subgraph of \(G\) if \(H\) is a subgraph of \(G\) and \(V(H) = V(G)\), that is, \(H\) contains all the vertices of \(G\), but possibly fewer edges.

Example 10

Considering the graph \(G\) of Example 8, let \(H\) be given by:

\(V(H) = V(G) = \{a, b, c, d, e\}\), \(E(H) = \{(a,b),\ (a,c),\ (c,d)\}\)

Since \(V(H) = V(G)\) and \(E(H) \subseteq E(G)\), \(H\) is a spanning subgraph of \(G\).

The spanning subgraph \(H\) keeps all 5 vertices of \(G\), but preserves only 3 of the 6 edges, and the vertex \(e\) is isolated.

G with 6 edges and spanning subgraph H with all vertices but only 3 edges
Example 10: spanning subgraph

The following diagram summarizes the relationships among the types of subgraph studied and their special cases.

flowchart TD
    A["Subgraph H ⊆ G
V(H) ⊆ V(G) and E(H) ⊆ E(G)"] --> B["Induced Subgraph G[A]
inherits all edges of G
whose two endpoints are in A"] A --> C["Spanning Subgraph
V(H) = V(G)
possibly fewer edges"] B --> D["Clique A
G[A] is complete (= Kk)"] B --> E["Independent Set S
G[S] is null (= Ns)"]

Special Graphs: Complete and Null
#

Complete Graph \(K_n\)

A graph \(G\) is said to be complete if all of its pairs of distinct vertices are adjacent. In other words, all of its vertices are universal. A complete graph with \(n\) vertices is denoted by \(K_n\).

Number of edges: \(|E(K_n)| = \binom{n}{2} = \dfrac{n(n-1)}{2}\)

Example 11
  • \(K_1\): 1 vertex, 0 edges
  • \(K_2\): 2 vertices, 1 edge
  • \(K_3\): 3 vertices, 3 edges
  • \(K_4\): 4 vertices, 6 edges
  • \(K_5\): 5 vertices, 10 edges

The first five complete graphs are shown below.

K1 to K5 in a row, showing the growth of the number of edges
Example 11: complete graphs K1 to K5

Clique
#

Clique

Let \(G\) be a graph and \(A \subseteq V(G)\) a subset of vertices. \(A\) is a clique of \(G\) if \(G[A]\) is a complete graph: every pair of vertices in \(A\) is adjacent.

Example 12

Let \(G\) be a graph with \(V = \{a,b,c,d,e,f,g,h\}\) and edges:

$$(a,b),\ (a,c),\ (a,d),\ (b,c),\ (b,d),\ (c,d),\ (c,e),\ (e,f),\ (c,f),\ (c,h),\ (h,g),\ (g,f)$$

The following subsets are cliques of \(G\):

  • \(A_1 = \{a, b, c, d\}\): clique of size 4 (\(G[A_1] = K_4\))
  • \(A_2 = \{c, e, f\}\): clique of size 3 (\(G[A_2] = K_3\))
  • \(A_3 = \{g, h\}\): clique of size 2

Other \(A_i\) are also possible: any subset of \(A_1\) with 2 or 3 vertices (for example \(\{a,b,c\}\), \(\{a,c,d\}\)) forms a clique. A clique is maximal when it is not contained in any larger clique, and maximum when no clique of the graph has more vertices than it does. \(A_1\), \(A_2\), and \(A_3\) are maximal, as are \(\{c,h\}\) and \(\{f,g\}\), but only \(A_1\), with 4 vertices, is maximum. Finding a maximum clique in a large graph is a hard problem: no efficient algorithm is known for the general case (see the entry Clique problem).

The figure below shows \(G\) with the vertices colored by group: \(A_1\) in blue, \(A_2\) in orange, \(A_3\) in green; the vertex \(c\) (shared by \(A_1\) and \(A_2\)) is highlighted.

Graph with 8 vertices with cliques K4 and K3 identified by colors
Example 12: cliques in G

Null Graph
#

The natural counterpart of \(K_n\) is the null graph: instead of all pairs being adjacent, no pair is adjacent.

Null Graph \(N_n\)

A graph \(G\) is said to be null (or completely independent) if none of its pairs of distinct vertices are adjacent. In other words, all of its vertices are isolated. A null graph with \(n\) vertices is denoted by \(N_n\).

Example 13
  • \(N_1\): 1 vertex, 0 edges
  • \(N_2\): 2 vertices, 0 edges
  • \(N_3\): 3 vertices, 0 edges
  • \(N_4\): 4 vertices, 0 edges
  • \(N_5\): 5 vertices, 0 edges

The first five null graphs are shown below.

N1 to N5 in a row, all without edges
Example 13: null graphs N1 to N5

Independent Set
#

Independent Set

Let \(G\) be a graph and \(S \subseteq V(G)\) a subset of vertices. \(S\) is an independent set (or stable set) of \(G\) if \(G[S]\) is a null graph: no pair of vertices in \(S\) is adjacent.

Example 14

Let \(G\) be the graph of Example 12. The following subsets are independent sets of \(G\):

  • \(S_1 = \{a, e, g\}\)
  • \(S_2 = \{e, h\}\)
  • \(S_3 = \{d, h, f\}\)

The figure shows \(G\) with the independent set \(S_1 = \{a, e, g\}\) highlighted: no pair of these vertices shares an edge.

Graph with 8 vertices with independent set S1={a,e,g} highlighted
Example 14: independent set S1

Clique / independent set duality

If \(A\) is a clique in \(G\), then \(A\) is an independent set in the complement \(\bar{G}\), and vice versa. This follows directly from the definitions: the edges present in \(G[A]\) are absent from \(\bar{G}[A]\), turning a complete subgraph into a null subgraph.

Exercises
#

The following exercises consolidate the concepts presented: neighborhood, complement, subgraphs, and independence.

Exercise 1: Neighborhood and special vertices

Statement:

Given the graph \(G = (V, E)\) with \(V = \{1, 2, 3, 4, 5\}\) and

$$E = \{(1,2),\ (1,3),\ (2,4),\ (3,4),\ (4,5)\}$$

a) Compute \(N(v)\) for each vertex \(v \in V\).

b) Is there any isolated vertex? And any universal vertex?

Solution

a) Going through the edges for each vertex:

  • \(N(1) = \{2, 3\}\)
  • \(N(2) = \{1, 4\}\)
  • \(N(3) = \{1, 4\}\)
  • \(N(4) = \{2, 3, 5\}\)
  • \(N(5) = \{4\}\)

b) No vertex has \(N(v) = \emptyset\), so there is no isolated vertex. No vertex has \(N(v) = V - \{v\}\) (for example, \(N(1) = \{2,3\} \neq \{2,3,4,5\}\)), so there is no universal vertex.

The graph \(G\) with all neighborhoods annotated:

Graph G of Exercise 1 with neighborhoods N(v) annotated at each vertex
Exercise 1: graph G and neighborhoods

Exercise 2: Complement graph

Statement:

Let \(G\) be the graph of Exercise 1. Determine \(\bar{G}\).

Solution

\(K_5\) has \(\binom{5}{2} = 10\) edges. Since \(|E(G)| = 5\), the complement has \(10 - 5 = 5\) edges, which are the pairs that do not appear in \(G\):

$$E(\bar{G}) = \{(1,4),\ (1,5),\ (2,3),\ (2,5),\ (3,5)\}$$

\(G\) and \(\bar{G}\) side by side:

G and its complement Ḡ side by side with 5 edges each
Exercise 2: G and complement

Exercise 3: Induced subgraph and independent set

Statement:

Let \(G\) be the graph of Exercise 1 and \(A = \{1, 2, 4\}\).

a) Determine the induced subgraph \(G[A]\).

b) Is \(S = \{1, 5\}\) an independent set of \(G\)? Justify.

Solution

a) \(V(G[A]) = \{1, 2, 4\}\). The edges of \(G\) with both endpoints in \(A\) are \((1,2)\) and \((2,4)\). Therefore:

$$E(G[A]) = \{(1,2),\ (2,4)\}$$

b) Yes. The only pair in \(S\) is \(\{1, 5\}\), and \((1,5) \notin E(G)\). Hence \(G[S]\) is a null graph and \(S\) is an independent set.

On the left: \(G\) with \(A = \{1,2,4\}\) in orange and the edges of \(G[A]\) highlighted. On the right: \(S = \{1,5\}\) in green, with no edge between them.

G with A={1,2,4} highlighted and G with S={1,5} as an independent set
Exercise 3: induced subgraph and independent set

Summary
#

Concept Symbol/Notation Description
Simple graph \(G = (V, E)\) Vertices + edges (unordered pairs)
Edge \(e = (v, w)\) Unordered pair; \(v\) and \(w\) are the endpoints
Endpoints of an edge \(v, w\) The two vertices that form the edge \((v, w)\)
Incidence n/a \(e = (v, w)\) is incident to the vertices \(v\) and \(w\)
Number of vertices \(n\) \(n = \lvert V(G) \rvert\)
Number of edges \(m\) \(m = \lvert E(G) \rvert\)
Neighborhood \(N(v)\), \(N_G(v)\) Set of neighbors of \(v\) in \(G\)
Isolated vertex n/a \(N(v) = \emptyset\)
Universal vertex n/a \(N(v) = V - \{v\}\)
Complement \(\bar{G}\) Same \(V\), complementary edges
Subgraph \(H \subseteq G\) \(V(H) \subseteq V(G)\) and \(E(H) \subseteq E(G)\)
Induced subgraph \(G[A]\) Vertices of \(A\) + all inherited edges
Spanning subgraph n/a \(V(H) = V(G)\), possibly fewer edges
Complete graph \(K_n\) Every pair adjacent; \(\binom{n}{2}\) edges
Null graph \(N_n\) No edges; all vertices isolated
Clique n/a \(A \subseteq V(G)\) with \(G[A]\) complete
Independent set n/a \(S \subseteq V(G)\) with \(G[S]\) null

Next Steps
#

With the vocabulary established (vertices, edges, neighborhood, subgraphs, and special graphs), we have the basis to start measuring local properties of each vertex. What is still missing is quantifying how many edges are incident to each vertex: this measure, called the degree, is the central object of the next article, where we will also prove the Handshaking Theorem, which relates the sum of the degrees to the number of edges of the graph.

The Mathematics of Connections - This article is part of a series.
Part 3: This Article

Related

Eulerian and Hamiltonian Graphs

·6397 words·31 mins
Traversing each edge exactly once is easy to decide: just look at the parity of the degrees (Euler’s Theorem). Deciding whether we can visit each vertex exactly once is NP-complete. We will see both problems, the theorems of Dirac and Ore, and the Traveling Salesman, from Held-Karp to Christofides.