2. Methodical guidelines / Методичні вказівки
This section is self-contained: it collects the theory needed for the theme — graphs and their adjacency matrices, and vertex/edge colouring — together with the techniques used to solve the tasks in 3classroom.md. For fuller treatment see Lecture 10, §10.6–10.12.
2.1 Graphs, degrees, and kinds of edge
A graph is a set of vertices and a set of edges , each edge joining two vertices. The kinds we meet in this class:
- an undirected edge has no direction; a directed edge (an arc) points from to ;
- a loop is an edge from a vertex to itself;
- parallel (or multiple) edges join the same pair of vertices; a graph that allows loops and parallel edges is a multigraph. A graph with neither is simple.
The degree is the number of edge-ends at (a loop counts twice). In a digraph the out-degree counts arcs leaving and the in-degree counts arcs entering. The largest degree in is ; a set of pairwise-adjacent vertices is a clique, and the size of the largest one is .
2.2 The adjacency matrix
Number the vertices . The adjacency matrix is the table with
Reading a matrix, four features are immediate:
- Directed or undirected? For an undirected graph is symmetric (): the picture above the diagonal mirrors the picture below. If is not symmetric the graph is directed.
- Loops sit on the diagonal: is the number of loops at . (Here a loop counts once on the diagonal; some texts count it as — see the note in main.md.)
- Parallel edges show up as entries greater than : means three edges between and .
- Degrees. For an undirected graph the -th row sum equals (a loop, counted once in , must be added a second time to match the “loop counts twice” rule for degree). For a digraph the row sum is the out-degree and the column sum is the in-degree .
Example. The symmetric matrix (rows/cols )
| 0 | 1 | 0 | 1 | |
| 1 | 0 | 1 | 0 | |
| 0 | 1 | 0 | 1 | |
| 1 | 0 | 1 | 0 |
is symmetric with zero diagonal, so it is an undirected, loop-free, simple graph; the $1$s give the edges — a -cycle.
2.3 Drawing a graph from its adjacency matrix
- Place the vertices (a convenient layout — a circle or a square — keeps edges from crossing needlessly).
- Decide directed vs. undirected from the symmetry of .
- Off-diagonal entries: for each (with if undirected) draw edges between and — a single line, or parallel lines when the entry exceeds . For a digraph draw an arrow for and a separate arrow for .
- Diagonal entries: draw loops at .
- Check by reading the degrees back off the rows (and columns, for a digraph).
2.4 Vertex colouring and the chromatic number
A proper vertex colouring assigns a colour to every vertex so that adjacent vertices get different colours. The chromatic number is the fewest colours a proper colouring can use. (Loops make proper colouring impossible, and parallel edges do not matter — so depends only on the simple graph underneath.)
Two bounds trap :
- Lower bound — a clique. In a clique of size all vertices are mutually adjacent, so they need distinct colours: . In particular a single triangle forces .
- Upper bound — greedy. Colouring vertices one at a time, each has at most already-coloured neighbours, so one of colours is always free: .
Landmark values: iff there are no edges; ; and iff is bipartite iff has no odd cycle. Hence an even cycle has and an odd cycle has . To prove : exhibit a -colouring (so ) and a reason it cannot be done with fewer, usually a clique of size (so ).
2.5 Edge colouring and the chromatic index
A proper edge colouring colours the edges so that edges sharing a vertex get different colours; the fewest colours is the chromatic index . Equivalently, each colour class is a matching (a set of edges with no common endpoint).
- Lower bound — the busiest vertex. The edges at a maximum-degree vertex pairwise meet there, so all need different colours: .
- Vizing’s theorem. For a simple graph, . Graphs meeting the lower value are class 1; those needing are class 2. (For a multigraph the top can rise: , where is the largest edge multiplicity.)
- A counting bound. A colour class is a matching, so it has at most edges; hence . This is what pushes a small, edge-heavy multigraph above .
To prove : exhibit a -edge-colouring and give a reason fewer is impossible (, or the counting bound).
2.6 Working checklist
- Matrix → graph: check symmetry (directed or not); place the vertices; draw off-diagonal edges (parallel lines / arrows for entries ); add diagonal loops; verify degrees against row (and column) sums.
- Chromatic number : find the largest clique for a lower bound; colour greedily (hardest vertices first) for an upper bound; when the two meet you are done. A triangle already forces ; no odd cycle means .
- Chromatic index : start at ; try to build a -edge-colouring (class 1). If it is forced higher — by Vizing to , or by the counting bound for a dense multigraph — say so.