Graphs (Continued)

Hall’s marriage theorem

For a bipartite graph G=(V,E)G = (V,E), with bipartition (V1,V2)(V_1,V_2), there exists a matching MEM \subseteq E that covers V1V_1 (a complete matching) if and only if for all SV1,SN(S)S \subseteq V_1, |S| \le |N(S)|. Where SS is a subset of vertices and N(S)N(S) is the set of neighbours of vertices in SS.

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 G=(V,E)G = (V,E) is a simple graph where V=n|V| = n. Arbitrarily list the vertices of GG as v1,v2,...,vnv_1, v_2, ..., v_n.

The adjacency matrix, AA of GG, with respect to this listing of vertices, is the n×nn \times n binary matrix with its (i,j)th entry equal to 1 when viv_i and vjv_j 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 viv_i and vjv_j, 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 AA for a directed graph G=(V,E)G = (V,E) has a 1 in its (i,j)th position if there is an edge from viv_i to vjv_j, where v1,v2,...,vnv_1, v_2, ..., v_n is a list of the vertices.

Isomorphism

Two undirected graphs G1=(V1,E1)G_1 = (V_1,E_1) and G2=(V2,E2)G_2 = (V_2,E_2) are isomorphic if there exists a bijection, f:V1V2f: V_1 \to V_2, with the property that for all vertices a,bV1a,b \in V_1.

Such a function ff 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 n!n! 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 G=(V,E)G = (V,E), an integer n0n \ge 0, and vertices u,vVu,v \in V, a path of length nn from uu to vv in GG is a sequence:

x0,e1,x1,e2,...,xn1,en,xnx_0, e_1, x_1, e_2,...,x_{n−1}, e_n, x_n

of interleaved vertices xjVx_j \in V and edges eiEe_i \in E, such that x0=ux_0 = u and xn=vx_n = v, and such that ei=xi1,xiEe_i = \\{x_{i−1},x_i\\} \in E for all i1,...,ni \in \\{1,...,n\\}. Such a path starts at uu and ends at vv.

A path of length n1n \ge 1 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 G=(V,E)G = (V,E) 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 (u,v)(u,v) of a connected undirected graph GG.

A connected component H=(V,E)H = (V',E') of a graph G=(V,E)G = (V,E) is a maximal connected subgraph of GG, meaning HH is connected and VVV' \subseteq V and EEE' \subseteq E, but HH is not a proper subgraph of a larger connected subgraph RR of GG.

A directed graph G=(V,E)G = (V,E) is called ‘strongly connected’, if for every pair of vertices uu and vv in VV, there is a directed path from uu to vv, and a directed path from vv to uu.

A ‘strongly connected component’ of a directed graph GG, is a maximal strongly connected subgraph HH of GG which is not contained in a larger strongly connected subgraph of GG.

A directed acyclic graph is a directed graph that contains no circuits or loops.

Euler paths & circuits

An Euler path in a multigraph GG is a simple path that contains every edge of GG.

An Euler circuit in a multigraph GG is a simple circuit that contains every edge of GG.

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 GG has an Euler path which is not an Euler circuit if and only if GG has exactly two vertices of odd degree.

Hamiltonian paths & circuits

A Hamiltonian path in an undirected graph GG is a simple path that visits every vertex exactly once.

A Hamiltonian circuit in an undirected graph GG 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, G=(V,E)G = (V,E), with n3n \ge 3 vertices, in which deg(u)+deg(v)n\text{deg}(u) + \text{deg}(v) \ge n for every two non-adjacent vertices uu and vv in VV, has a Hamiltonian circuit.

Dirac’s theorem states every simple undirected graph, G=(V,E)G = (V,E), with n3n \ge 3 vertices, in which deg(u)n2\text{deg}(u) \ge \frac{n}{2} for all vertices uVu \in V, has a Hamiltonian circuit.

Dijkstra’s algorithm

An edge-weighted directed graph, G=(V,E,w)G = (V,E,w), has a function w:ENw: E \to \N which maps each edge to to a non-negative integer.

Consider a directed path:

x0e1x1e2...enxnx_0e_1x_1e_2...e_nx_n

from u=x0Vu = x_0 \in V to v=xnVv = x_n \in V, in graph G=(V,E,w)G = (V,E,w). The length of this path is defined to be:

i=0nw(xi1,xi)\displaystyle\sum\limits_{i=0}^{n} w(x_{i-1},x_i)

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 kk distinct colours with which to colour the vertices of a graph. Let [k]=1,...,k[k] = {1,...,k}. For an undirected graph, G=(V,E)G = (V,E), a valid k-colouring of GG is a function c:V[k]c: V \to [k], such that for all u,vVu,v \in V, if (u,v)E(u,v) \in E then c(u),=/,,c(v)c(u) \\, {=}\mathllap{/\\,} \\, c(v).

For an integer k1k \ge 1, we say an undirected graph G=(V,E)G = (V,E) is k-colourable if there exists a k-colouring of GG. The chromatic number of GG, denoted χ(G)χ(G), is the smallest positive integer kk, such that GG is k-colourable.

Ramsey’s theorem