A graph is built from two kinds of objects: vertices and edges. Vertices are the objects being related. Edges are the relations between them. In a simple undirected graph, an edge is an unordered pair of distinct vertices; in a directed graph, an edge is an ordered pair. This distinction is standard in elementary graph theory.
3.1 Vertices
A vertex is an element of the vertex set .
If
then each element of is a vertex of . Vertices may be written as
or as indexed symbols such as
The number of vertices in a graph is its order:
Vertices are sometimes called nodes, especially in computer science. In this book, the word vertex is used for the mathematical object. A vertex may have a label, but the label is only a name. The structure of the graph comes from adjacency, not from the spelling of the labels.
3.2 Edges
An edge is a connection between vertices.
In a simple undirected graph, an edge joining and is written as
The order of the endpoints does not matter:
Thus an undirected edge records a symmetric connection.
If
then and are called the endpoints of . The edge is said to join and .
The number of edges in a graph is its size:
3.3 The Incidence Relation
Incidence is the relation between vertices and edges.
An edge is incident with a vertex if is one of the endpoints of . If
then is incident with and incident with .
The terms adjacency and incidence should be kept separate.
| Term | Objects related | Meaning |
|---|---|---|
| Adjacent | vertex and vertex | Two vertices share an edge |
| Incident | vertex and edge | The vertex is an endpoint of the edge |
| Endpoint | vertex of an edge | A vertex used by an edge |
For example, if
then and are adjacent, while is incident with and with .
3.4 Adjacent Vertices
Two vertices are adjacent if an edge joins them.
In an undirected graph , vertices and are adjacent when
Adjacent vertices are also called neighbors.
The set of all neighbors of a vertex is called its neighborhood and is written as
For a simple graph,
If
and
then
and
3.5 The Degree of a Vertex
The degree of a vertex is the number of edges incident with it.
The degree of is written as
In a simple graph, the degree is the number of neighbors:
For example, let
Then
A vertex of degree is called an isolated vertex. A vertex of degree is called a leaf or pendant vertex.
Degree measures local connectivity. It tells how many immediate connections a vertex has, but it does not determine the whole position of the vertex in the graph.
3.6 Maximum and Minimum Degree
The maximum degree of a graph is the largest degree among its vertices. It is written as
The minimum degree of is the smallest degree among its vertices. It is written as
Thus
and
For a graph with degree sequence
we have
and
These quantities give coarse information about the graph. They do not describe the full graph, but they are often enough to state useful bounds.
3.7 Edge Endpoints
In a simple graph, every edge has exactly two distinct endpoints.
If
then
This excludes loops. It also means that every edge contributes one incidence to each of two different vertices.
In a multigraph or pseudograph, this convention may change. A loop has the same vertex as both endpoints. Multiple edges may share the same endpoint pair. Since conventions differ across books, one must always check what class of graph is being used.
3.8 Loops
A loop is an edge whose two endpoints are the same vertex.
A loop at may be written as
Simple graphs exclude loops. Pseudographs allow loops. Some multigraph conventions allow loops, while others allow multiple edges but still exclude loops.
In an undirected graph, a loop contributes to the degree of its vertex. This is because the loop has two ends, and both ends are incident with the same vertex.
For example, if has one ordinary edge incident with it and one loop at it, then
The ordinary edge contributes . The loop contributes .
3.9 Multiple Edges
Two edges are parallel if they have the same endpoints.
A graph that allows parallel edges is called a multigraph.
For example, suppose two vertices and are joined by three distinct edges:
Each edge has endpoint pair , but the edges are separate objects.
This distinction matters in applications. If vertices are cities and edges are roads, then two cities may be connected by several roads. A simple graph would record only whether a connection exists. A multigraph can record each road separately.
3.10 Directed Edges
In a directed graph, an edge has direction.
A directed edge from to is written as
The first vertex is the tail. The second vertex is the head.
Thus, for the arc
the tail is , and the head is .
Unlike undirected edges,
in general.
Directed edges model one-way relations: links, citations, dependencies, transitions, control flow, and precedence constraints.
3.11 In-Neighbors and Out-Neighbors
In a directed graph, a vertex has two kinds of neighbors.
The out-neighborhood of is the set of vertices reached by arcs leaving :
The in-neighborhood of is the set of vertices with arcs entering :
The corresponding degrees are
and
when the directed graph has no parallel arcs.
For example, if
then
and
Thus
and
3.12 Edge Sets as Data
In finite graph theory, an edge set is often written explicitly.
For example,
and
This is enough to define the graph completely.
From the edge set, one can recover adjacency, incidence, degree, neighborhoods, paths, and components. In a finite simple graph, the edge set is the complete structural record of the graph once the vertex set is fixed.
3.13 Vertex Labels and Structure
Vertex labels identify vertices, but they do not determine graph structure.
Consider the graph
Now consider
These graphs have different labels, but the same structure. Each is a path on three vertices.
Graph theory usually studies structure up to relabeling. This idea is formalized by graph isomorphism.
3.14 Edge Labels and Weights
Edges may carry additional information.
A weighted edge has a numerical value. A labeled edge has a name, type, or category.
For example, in a transportation graph, an edge may have a distance:
In a knowledge graph, an edge may have a relation label:
The unweighted graph records only adjacency. The weighted or labeled graph records additional data attached to the connection.
It is useful to separate the underlying graph from the data stored on it. The underlying graph tells which vertices are connected. The labels and weights describe the kind or cost of each connection.
3.15 Complete and Empty Edge Sets
For a simple graph on vertices, the largest possible edge set contains one edge for every pair of distinct vertices.
This gives the complete graph . Its edge set has size
A complete graph is therefore the graph with maximum possible adjacency among vertices.
At the other extreme is the empty graph on vertices, whose edge set is
In the empty graph, every vertex has degree . In the complete graph , every vertex has degree .
3.16 The Handshaking Principle
Because every edge in a finite undirected graph has two endpoints, the total degree count is twice the number of edges:
This identity is called the degree sum formula or the handshaking lemma. It implies that the number of vertices of odd degree is even.
The formula is a basic example of double counting. Count incidences between vertices and edges in two ways. Counting by edges gives . Counting by vertices gives the sum of the degrees.
3.17 Example
Let
and
The order is
The size is
The neighborhoods are
The degrees are
The degree sum is
Since
the handshaking lemma holds.
3.18 Summary
Vertices are the objects of a graph. Edges are the connections between them. An edge has endpoints. An edge is incident with its endpoints. Two vertices are adjacent when an edge joins them.
The local structure around a vertex is described by its neighborhood and degree. In directed graphs, edges have tails and heads, so neighborhoods and degrees split into incoming and outgoing versions.
The edge set determines the adjacency structure of a finite graph. By studying how vertices and edges interact, graph theory builds the language needed for paths, cycles, connectivity, trees, colorings, matchings, flows, and graph algorithms.