Graphs (Continued)
Hall’s marriage theorem
For a bipartite graph , with bipartition , there exists a matching that covers (a complete matching) if and only if for all . Where is a subset of vertices and is the set of neighbours of vertices in .
This can also apply to perfect matchings that cover all vertices in a graph.
Adjacency matrices
An adjacency list represents a graph by specifying the vertices that are adjacent to each other vertex.
Suppose that is a simple graph where . Arbitrarily list the vertices of as .
The adjacency matrix, of , with respect to this listing of vertices, is the binary matrix with its (i,j)th entry equal to 1 when and are adjacent, and equal to 0 when they are not adjacent.
The adjacency matrix of an undirected graph is always symmetric. Also, if there are no loops, each diagonal entry is zero.
When multiple edges connect vertices and , the (i,j)th entry equals the number of edges connecting the pair of vertices.
Adjacency matrices can represent directed graphs in exactly the same way. The matrix for a directed graph has a 1 in its (i,j)th position if there is an edge from to , where is a list of the vertices.
Isomorphism
Two undirected graphs and are isomorphic if there exists a bijection, , with the property that for all vertices .
Such a function is called an ‘isomorphism’. Intuitively, isomorphic graphs are ‘the same’, except for ‘renamed’ vertices.
It is difficult to determine whether two graphs are isomorphic by brute force: there are bijections between vertices of two n-vertex graphs. Often, we can show two graphs are not isomorphic by finding a property that only one of the two graphs has. Such a property is called the ‘graph invariant’. For example, the number of vertices of a given degree.
Paths
Informally, a path is a sequence of edges connecting vertices.
Formally, an undirected graph , an integer , and vertices , a path of length from to in is a sequence:
of interleaved vertices and edges , such that and , and such that for all . Such a path starts at and ends at .
A path of length is called a ‘circuit’ if the path starts and ends at the same vertex. A path or circuit is called ‘simple’ if it does not contain the same edge more than once.
Connectedness
An undirected graph is called ‘connected’ if there is a path between every pair of distinct vertices.
There is always a simple path between any pair of vertices of a connected undirected graph .
A connected component of a graph is a maximal connected subgraph of , meaning is connected and and , but is not a proper subgraph of a larger connected subgraph of .
A directed graph is called ‘strongly connected’, if for every pair of vertices and in , there is a directed path from to , and a directed path from to .
A ‘strongly connected component’ of a directed graph , is a maximal strongly connected subgraph of which is not contained in a larger strongly connected subgraph of .
A directed acyclic graph is a directed graph that contains no circuits or loops.
Euler paths & circuits
An Euler path in a multigraph is a simple path that contains every edge of .
An Euler circuit in a multigraph is a simple circuit that contains every edge of .
A connected undirected multigraph with at least two vertices has an Euler circuit if and only if each of its vertices has even degree.
A connected undirected multigraph has an Euler path which is not an Euler circuit if and only if has exactly two vertices of odd degree.
Hamiltonian paths & circuits
A Hamiltonian path in an undirected graph is a simple path that visits every vertex exactly once.
A Hamiltonian circuit in an undirected graph is a simple circuit that passes through every vertex, except for the common start and end, exactly once.
Ore’s theorem states every simple undirected graph, , with vertices, in which for every two non-adjacent vertices and in , has a Hamiltonian circuit.
Dirac’s theorem states every simple undirected graph, , with vertices, in which for all vertices , has a Hamiltonian circuit.
Dijkstra’s algorithm
An edge-weighted directed graph, , has a function which maps each edge to to a non-negative integer.
Consider a directed path:
from to , in graph . The length of this path is defined to be:
This length can also be found algorithmically:
Initalise: S = {s}; L(s) = 0;
Initalise: L(v) = w(s,v), for all v in V-{s};
While (S != V) do
u = arg(min(z in V-S)) {L(z)};
S = S U {u};
For all v in V-S such that (u,v) in E do
L(v) = min(L(v), L(u) + w(u,v));
End for
End while
Output function L(.);
Read up more on this.
Graph colouring
Suppose we have distinct colours with which to colour the vertices of a graph. Let . For an undirected graph, , a valid k-colouring of is a function , such that for all , if then .
For an integer , we say an undirected graph is k-colourable if there exists a k-colouring of . The chromatic number of , denoted , is the smallest positive integer , such that is k-colourable.