A directed graph is a pair , where is a finite set and is a binary relation on . An undirected graph is a pair , where is a finite set and is a set of unordered pair of vertices from . In both types of graphs, is called the vertex set of and is called the edge set of .
Incidence
If is an edge of a directed graph, we say is incident to and incident from. Furthermore, we say is adjacent to . If was instead an edge of an undirected graph, we say is incident on and . Likewise, is adjacent to and is adjacent to .
Handshake Lemma
In any graph, the sum of the degrees of vertices in the graph is always twice the number of edges:
Completeness
A complete graph is an undirected graph in which each vertex is connected to every other vertex. The complete graph on vertices is denoted by .
Likewise, a complete digraph is a digraph in which every distinct ordered pair of vertices is connected by a unique edge.
Subgraphs
We say is a subgraph of provided and . We say is an induced subgraph of provided and every edge in whose vertices are still in is also an edge in .
Cliques
A clique of undirected graph is a complete induced subgraph of . In other words, it is a subset of such that every two distinct vertices in the clique are adjacent.
A -clique is a clique that contains nodes.
Multigraphs
A graph that allows multiple edges between vertices is called a multigraph. It is analogous to the concept of multisets in set theory.
Walks
Let be a graph. A walk of is a sequence of vertices such that consecutive vertices in the sequence are adjacent in . More precisely, a walk (of length ) from vertex to vertex is a sequence of vertices such that for .
We say is reachable from via . We denote reachability of from as .
A path is a trail in which no vertex is repeated (except possibly the first repeated as the last). A cycle is a path that starts and ends at the same vertex. A graph with no cycles is acyclic.
In computer science, a cycle is sometimes required to have more than one edge:
In a directed graph, path is a cycle if and the path contains at least one edge.
In an undirected graph, path is a cycle if and all edges are distinct.
Hamiltonian Path
A Hamiltonian path is a path that visits every vertex in the graph exactly once (except possibly the first repeated as the last). A Hamiltonian cycle is a Hamiltonian path that starts and ends on the same vertex.
Transpose
Let be a directed graph. We define the transpose of as where
Components
An undirected graph is connected if every two vertices are reachable from one another. The connected components of an undirected graph are the equivalence classes under the "is mutually reachable" relation.
A directed graph is strongly connected if every two vertices are reachable from one another. The strongly connected components of a digraph are the equivalence classes under the "is mutually reachable" relation.
A directed graph is weakly connected if for every two vertices, one is reachable from the other. In other words, a directed graph is weakly connected if its corresponding undirected graph is connected.
Cuts
Let be an undirected graph. A cut of is a partition of . We say an edge crosses the cut if one of its endpoints belongs to and the other belongs to . A cut respects a set of edges if no edge in crosses the cut. An edge is a light edge crossing a cut if its weight is the minimum of any edge crossing the cut.
Isomorphisms
An isomorphism between two graphs and is a bijection between the vertices of the graphs such that is an edge in if and only if is an edge in . Here parenthesis are used to denote either ordered pairs (for directed graphs) or unordered pairs (for undirected graphs).
We say and are isomorphic, denoted , if and only if there exists an isomorphism between and .