Graph theory begins with a small vocabulary. The terms are simple, but they must be used precisely. Most later theorems depend on exact distinctions among vertices, edges, adjacency, incidence, degree, paths, cycles, and subgraphs.
2.1 Graph
A graph is an ordered pair
where is a set of vertices and is a set of edges.
The set is called the vertex set of . The set is called the edge set of . When needed, they are written as
and
A graph records relationships among elements of . Each edge represents one such relationship.
For example, let
and
Then
is a graph with four vertices and three edges.
2.2 Vertex
A vertex is a basic object of a graph.
Vertices are also called nodes, especially in computer science and network applications. In this book, the word vertex is used for the mathematical object. The word node may appear when discussing algorithms, data structures, or networks.
A vertex may have a label, such as , , , , or . The label names the vertex. It does not determine its mathematical role.
Two graphs may have different vertex labels but the same structure. This point becomes important in the study of graph isomorphism.
2.3 Edge
An edge is a connection between vertices.
In an undirected graph, an edge joining and is written as
The order does not matter:
In a directed graph, an edge from to is written as
Here the order matters. The edge begins at and ends at .
Undirected edges express symmetric relations. Directed edges express ordered or one-way relations.
2.4 Order and Size
The order of a graph is the number of vertices.
If , then the order of is
The size of a graph is the number of edges:
For example, if
and
then the graph has order and size .
Order measures how many objects the graph contains. Size measures how many connections it contains.
2.5 Adjacent Vertices
Two vertices are adjacent if there is an edge between them.
In an undirected graph, and are adjacent when
The vertices and are then called neighbors.
The set of all neighbors of is called the neighborhood of . It is often written as
For example, if
then
2.6 Incidence
An edge is incident with a vertex if the vertex is one of its endpoints.
If
then is incident with and with .
The vertices and are called the endpoints of .
Adjacency is a relation between vertices. Incidence is a relation between a vertex and an edge.
| Term | Relation |
|---|---|
| Adjacent | vertex to vertex |
| Incident | vertex to edge |
| Endpoint | vertex belonging to an edge |
2.7 Degree
The degree of a vertex in an undirected graph is the number of edges incident with it.
The degree of is written as
For a simple graph, this is the same as the number of neighbors of :
For example, let
Then
A vertex of degree is called an isolated vertex. A vertex of degree is called a leaf or pendant vertex.
2.8 The Handshaking Lemma
In every finite undirected graph, the sum of all vertex degrees equals twice the number of edges:
Each edge has two endpoints. Therefore each edge contributes to the total degree count.
This result is called the handshaking lemma. It is one of the first counting principles in graph theory.
A direct consequence is that the number of vertices of odd degree is even. Since the total degree sum is even, an odd number of odd summands cannot occur.
2.9 Loop
A loop is an edge that joins a vertex to itself.
A loop at is written as
in an undirected setting, or as
in a directed setting.
Simple graphs do not allow loops. Multigraphs may allow them.
A loop contributes to the degree of its vertex in an undirected graph, because both endpoints are the same vertex but the edge still has two ends.
2.10 Multiple Edges
Two or more edges are parallel or multiple edges if they join the same pair of vertices.
A simple graph has at most one edge between any two distinct vertices. A multigraph allows multiple edges.
For example, if two cities are connected by several different roads, then a multigraph may represent each road as a separate edge.
| Graph type | Loops allowed | Multiple edges allowed |
|---|---|---|
| Simple graph | No | No |
| Multigraph | Usually yes or sometimes no, depending on convention | Yes |
| Pseudograph | Yes | Yes |
| Directed graph | Depends on convention | Depends on convention |
Conventions vary. A reference text should state its convention before proving results.
2.11 Simple Graph
A simple graph is an undirected graph with no loops and no multiple edges.
In a simple graph, every edge is a two-element subset of the vertex set. Thus an edge has the form
where
Most introductory graph theory begins with simple graphs because they expose the core ideas without additional technical cases.
Unless otherwise stated, the word graph in many chapters of this book means finite simple undirected graph.
2.12 Complete Graph
A complete graph is a simple graph in which every pair of distinct vertices is adjacent.
The complete graph on vertices is denoted by
Its number of edges is
For example, has one vertex and no edges. has two vertices and one edge. is a triangle. has four vertices and six edges.
Complete graphs often serve as extremal examples because they contain the largest possible number of edges for a simple graph of fixed order.
2.13 Empty and Null Graphs
An empty graph is a graph with vertices but no edges.
If
and
then the graph has order and size .
Some authors use the term null graph for a graph with no vertices. Other authors use it for a graph with vertices and no edges. To avoid ambiguity, this book uses:
| Term | Meaning |
|---|---|
| Empty graph | Vertices, no edges |
| Null graph | No vertices, no edges |
2.14 Directed Graph
A directed graph, or digraph, is a graph whose edges have directions.
A directed graph is written as
where is the vertex set and is the set of arcs.
An arc from to is written as
The vertex is the tail of the arc. The vertex is the head of the arc.
In a directed graph, and are different arcs.
2.15 In-Degree and Out-Degree
In a directed graph, the out-degree of a vertex is the number of arcs leaving it. The in-degree is the number of arcs entering it.
These are written as
and
For example, if
then
The directed version of the handshaking lemma says
Each arc leaves exactly one vertex and enters exactly one vertex.
2.16 Weighted Graph
A weighted graph is a graph in which each edge has an associated value called a weight.
A weight may represent distance, cost, capacity, time, probability, similarity, or resistance.
If is a weight function, then
denotes the weight of edge .
For example, in a road network, vertices may be cities and edge weights may be distances between cities.
Weighted graphs are essential in shortest path problems, minimum spanning trees, network flow, optimization, and many applications.
2.17 Labeled Graph
A labeled graph is a graph whose vertices or edges carry labels.
A vertex label may be a name, identifier, type, coordinate, or record. An edge label may represent a relation type, timestamp, direction, cost, or category.
Labels are part of the data model. Two graphs may have the same adjacency pattern but different labels.
In pure graph theory, labels are often ignored unless explicitly needed. In applications, labels usually carry important semantic information.
2.18 Finite and Infinite Graphs
A graph is finite if its vertex set and edge set are finite.
A graph is infinite if its vertex set or edge set is infinite.
Most algorithmic graph theory concerns finite graphs. Infinite graphs appear in logic, topology, group theory, model theory, and the study of infinite networks.
In this book, graphs are finite unless otherwise stated.
2.19 Subgraph
A subgraph of a graph is a graph formed from some vertices and some edges of .
If
then
is a subgraph of when
and
Every edge in must have both endpoints in .
Subgraphs allow one to study parts of a graph. A path, a cycle, a component, and a tree inside a graph are all examples of subgraphs.
2.20 Induced Subgraph
An induced subgraph is formed by choosing vertices and keeping all edges among them that appear in the original graph.
If , then the subgraph induced by is written as
Its vertex set is . Its edge set contains every edge of whose endpoints both lie in .
Thus an induced subgraph is determined completely by its chosen vertex set.
This differs from an arbitrary subgraph, where one may choose to keep or discard edges.
2.21 Spanning Subgraph
A spanning subgraph is a subgraph that contains all vertices of the original graph.
If is a spanning subgraph of , then
The edge set may be smaller than .
A spanning tree is an important example. It contains all vertices of a connected graph and enough edges to connect them without cycles.
2.22 Complement
The complement of a simple graph is the graph with the same vertex set, where two distinct vertices are adjacent in exactly when they are not adjacent in .
Thus,
For distinct vertices and ,
exactly when
The complement exchanges edges and non-edges.
If has vertices and edges, then
has
edges.
2.23 Isomorphism
Two graphs are isomorphic if they have the same structure after relabeling vertices.
Graphs and are isomorphic if there exists a bijection
such that for all vertices ,
if and only if
The function is called an isomorphism.
Isomorphic graphs have the same order, size, degree sequence, number of components, number of cycles of each length, and other structural properties. Different drawings or different vertex names do not change the graph structure.
2.24 Degree Sequence
The degree sequence of a finite graph is the list of vertex degrees, usually written in nonincreasing order.
For example, if the degrees are
then the degree sequence is
The degree sequence is a graph invariant. Isomorphic graphs have the same degree sequence.
The converse is not always true. Two non-isomorphic graphs may have the same degree sequence.
2.25 Summary
The basic language of graph theory consists of vertices, edges, adjacency, incidence, degree, subgraphs, complements, and isomorphisms.
A graph has order and size . In an undirected graph, degree counts incident edges. In a directed graph, in-degree and out-degree count entering and leaving arcs. Simple graphs exclude loops and multiple edges. Multigraphs and directed graphs extend the basic model.
These definitions form the grammar of graph theory. Later chapters use them to define paths, cycles, connectedness, trees, colorings, matchings, flows, and spectra.