📚 Graph Theory Revision for IB & CCEA Maths | IB & CCEA 数学图论考点精讲
Graph theory is a vibrant area of discrete mathematics that surfaces in both the IB Analysis & Approaches/Applications & Interpretation courses and the CCEA GCE Decision Mathematics modules. From drawing simple graphs to solving complex routing problems, grasping the core concepts and algorithms is essential for exam success. This article walks you through the key topics, with clear explanations and worked examples, to help you master graph theory for your IB or CCEA maths exam.
图论是离散数学中一个活跃的领域,既出现在 IB 数学分析与方法/应用与解释课程中,也是 CCEA 决策数学模块的核心内容。从绘制简单图到解决复杂的路径问题,掌握核心概念与算法对于考试成功至关重要。本文将带你梳理关键考点,配以清晰的解释和实例,助力你在 IB 或 CCEA 数学考试中拿下图论部分。
1. Graph Basics | 图论基本概念
A graph G consists of a set of vertices V (nodes) and a set of edges E connecting them. If the edges carry an arrow, the graph is directed (digraph); otherwise it is undirected. The degree of a vertex is the number of edges incident to it – loops count twice. A simple graph has no loops or multiple edges between the same pair of vertices.
图 G 由顶点集 V(结点)和边集 E 组成,边用于连接顶点。如果边带有箭头,该图就是有向图,否则是无向图。顶点的度数是指与该顶点相关联的边的数目——环算作两次。简单图不含环,也不存在连接同一对顶点的多重边。
- Vertex (node): a point in the graph. – 顶点(结点):图中的点。
- Edge (arc): a line connecting two vertices. – 边(弧):连接两个顶点的线。
- Adjacent vertices: two vertices joined by an edge. – 邻接顶点:由一条边相连的两个顶点。
- Path: a sequence of edges connecting a sequence of distinct vertices. – 路径:由边组成的序列,连接一连串各不相同的顶点。
- Cycle (circuit): a closed path where the start and end vertices are the same, and all other vertices are distinct. – 回路:起点与终点相同且其余顶点各异的闭合路径。
- Connected graph: there exists a path between every pair of vertices. – 连通图:任意两个顶点之间都存在路径。
Many exam questions begin by asking you to list vertex degrees or to verify Euler’s handshaking lemma: ∑ deg(v) = 2|E|. This relation is vital for checking consistency in a graph description.
许多考题会先要求你列出各顶点的度数,或验证欧拉握手引理:所有顶点度数之和等于边数的两倍(∑ deg(v) = 2|E|)。这个关系在检查图的描述一致性时至关重要。
2. Representing Graphs | 图的表示方法
For computational and matrix‑based problems, you need to represent a graph efficiently. The two most common representations are the adjacency matrix and the distance/weight matrix. The adjacency matrix is a square matrix where entry (i, j) is 1 if there is an edge between vertex i and j, and 0 otherwise. For weighted graphs, we use the weight matrix, recording the weight of each edge directly, with ‘–’ or ∞ for absent edges.
为了进行基于矩阵的计算,你需要高效地表示一个图。最常见的两种表示是邻接矩阵和距离/权值矩阵。邻接矩阵是一个方阵,若顶点 i 与 j 之间有边,则 (i, j) 元为 1,否则为 0。对于加权图,我们使用权值矩阵,直接记录每条边的权重,不存在的边用 “–” 或 ∞ 表示。
For example, a simple graph with vertices A, B, C and edges AB, BC would have the following adjacency matrix:
例如,顶点为 A、B、C,边为 AB、BC 的简单图,其邻接矩阵如下:
| A | B | C | |
|---|---|---|---|
| A | 0 | 1 | 0 |
| B | 1 | 0 | 1 |
| C | 0 | 1 | 0 |
Both IB and CCEA exams expect you to construct these matrices from a given diagram and vice versa. Recognising symmetry in undirected graphs (matrix entries mirror across the main diagonal) can save time and help catch errors.
IB 和 CCEA 考试都要求你能够从给定的图构造这些矩阵,也能根据矩阵还原出图。利用无向图的对称性(矩阵元素关于主对角线对称)可以节省时间并帮助发现错误。
3. Trees and Spanning Trees | 树与生成树
A tree is a connected, undirected graph with no cycles. A tree with n vertices always has exactly n−1 edges. A spanning tree of a connected graph G is a subgraph that is a tree and includes every vertex of G. Finding a spanning tree is often the first step towards solving minimum connector problems.
树是一种连通且无回路的无向图。具有 n 个顶点的树恰好有 n−1 条边。连通图 G 的生成树是 G 的一个子图,它是一棵树,并且包含 G 的所有顶点。找到生成树通常是解决最小连接器问题的第一步。
Key properties to remember:
– Removing any edge from a tree disconnects it.
– Adding any edge to a tree creates exactly one cycle.
– For a weighted graph, a minimum spanning tree (MST) is a spanning tree with the smallest possible total edge weight.
需要牢记的关键性质:
– 从树中移除任意一条边都会使其不连通。
– 向树中添加任意一条边都会恰好产生一个回路。
– 对于加权图,最小生成树(MST)是总边权最小的生成树。
4. Minimum Spanning Tree Algorithms | 最小生成树算法
Two classic algorithms are used to find the MST: Kruskal’s algorithm and Prim’s algorithm. Both are explicitly required in IB (Applications & Interpretation HL) and CCEA Decision Maths.
有两种经典算法用于求最小生成树:Kruskal 算法和 Prim 算法。IB(应用与解释 HL)和 CCEA 决策数学都明确要求掌握这两种算法。
Kruskal’s Algorithm
1. Sort all edges in ascending order of weight.
2. Start with an empty edge set. Go through the sorted list, adding the edge if it does not form a cycle with the already chosen edges.
3. Stop when exactly n−1 edges have been added.
Kruskal 算法
1. 将所有边按权值升序排列。
2. 从空边集开始。遍历排序后的列表,如果当前边与已选边不构成回路,则将其加入。
3. 当恰好添加了 n−1 条边时停止。
Prim’s Algorithm (starting from any vertex)
1. Choose any starting vertex and mark it as connected.
2. Consider all edges connecting a connected vertex to an unconnected vertex; select the edge of smallest weight.
3. Add that edge and its new vertex to the connected set.
4. Repeat until all vertices are connected.
Prim 算法(可从任意顶点开始)
1. 任意选择一个起始顶点并将其标记为已连通。
2. 考虑所有连接已连通顶点与未连通顶点的边,从中选择权值最小的边。
3. 将该边及其连接的新顶点加入已连通集合。
4. 重复上述步骤,直至所有顶点都已连通。
Exam tip: When showing Prim’s algorithm in a table, list columns for each step, the chosen edge, its weight, and the cumulative weight. Clearly state your starting vertex – marks are often awarded for correct presentation.
应试技巧:用表格展示 Prim 算法时,列出每步的所选边、其权值和累计权值。明确写下起始顶点——规范的书写步骤往往能得分。
5. Shortest Path: Dijkstra’s Algorithm | 最短路径:Dijkstra 算法
Dijkstra’s algorithm finds the shortest path from a source vertex to all other vertices in a weighted graph without negative weights. It is a must‑know for IB AI HL and CCEA networks topics.
Dijkstra 算法用于在无负权边的加权图中找出从源顶点到其他所有顶点的最短路径。这是 IB 应用与解释 HL 和 CCEA 网络流专题的必考内容。
The algorithm works by maintaining two sets: visited vertices and unvisited vertices. Temporary labels (distances) are updated iteratively. The main steps are:
- Assign distance 0 to the start vertex, and distance ∞ to all others.
- Mark the start vertex as current. For each unvisited neighbour, calculate its tentative distance as current distance + edge weight. If this is less than the recorded distance, update it.
- Once all neighbours are considered, mark the current vertex as visited. A visited vertex will not be checked again.
- Choose the unvisited vertex with the smallest tentative distance as the new current vertex and repeat.
- Stop when the target vertex is visited, or all vertices are visited.
Dijkstra 算法通过维护两个顶点集合(已访问和未访问)来实现,并反复更新临时标号(距离)。主要步骤如下:
- 将起始顶点的距离设为 0,其余顶点的距离初始化为 ∞。
- 将起始顶点设为当前顶点。对于每个未访问的相邻顶点,计算其试探距离 = 当前距离 + 边权。若该值小于已记录的距离,则更新。
- 处理完所有相邻顶点后,将当前顶点标记为已访问。已访问顶点不再被检查。
- 选择未访问顶点中试探距离最小的作为新的当前顶点,重复上述过程。
- 当目标顶点被标记为已访问,或所有顶点均已访问时停止。
You must be able to record your working clearly, usually in a table showing each vertex’s temporary label, order of permanent labelling, and the previous vertex on the shortest path. The final shortest path is then retraced from the destination back to the start.
你必须能够清楚地记录计算过程,通常在一个表格中标出每个顶点的试探标号、永久标号顺序以及最短路径上的前驱顶点。最短路径最后通过从终点回溯到起点得到。
6. Eulerian Graphs and the Chinese Postman Problem | 欧拉图与中国邮递员问题
An Eulerian trail uses every edge of a graph exactly once; an Eulerian circuit is a closed Eulerian trail. A connected graph is Eulerian (has an Eulerian circuit) if and only if every vertex has even degree. It is semi‑Eulerian (has an Eulerian trail but no circuit) if exactly two vertices have odd degree.
欧拉迹是恰好经过图中每条边一次的迹;欧拉回路是一条闭合的欧拉迹。一个连通图是欧拉图(存在欧拉回路)当且仅当所有顶点度数均为偶数。若恰好有两个顶点度数为奇数,则该图是半欧拉图,存在欧拉迹但无欧拉回路。
The Chinese postman problem (route inspection) asks for the shortest closed walk that covers every edge at least once. In a Eulerian graph, the solution is simply the Eulerian circuit, with total length equal to the sum of all edge weights. In a semi‑Eulerian graph, you must find a pairing of the odd‑degree vertices that minimises the extra distance added to make the graph Eulerian. This is done by finding the shortest paths between all pairs of odd vertices and choosing the minimum‑weight matching.
中国邮递员问题(路线检查问题)要求找出一条经过每条边至少一次的最短闭合路径。在欧拉图中,解就是欧拉回路本身,总长度等于所有边权之和。在半欧拉图中,必须找出奇度顶点之间的配对方式,使得为使图变为欧拉图而额外重复走的距离最小。这需要找出所有奇度顶点对之间的最短路径,并选取总权最小的匹配。
IB typically tests this with small graphs where you can pair odd vertices by inspection. CCEA may involve more systematic listing and comparison.
IB 通常在小图上考查,你可以通过观察直接配对奇度顶点;CCEA 可能会要求更系统地列出并比较各种配对。
7. Hamiltonian Graphs and the Travelling Salesman Problem | 哈密顿图与旅行商问题
A Hamiltonian cycle visits every vertex of a graph exactly once and returns to the start. There is no simple necessary‑and‑sufficient condition like Euler’s theorem; you usually have to spot a cycle by inspection or try systematic permutations.
哈密顿回路恰好经过图中每个顶点一次并返回起点。它不像欧拉图那样具有简洁的充要条件,通常需要通过观察发现回路,或通过系统的排列尝试来寻找。
The travelling salesman problem (TSP) is the classic optimisation problem: find the Hamiltonian cycle of smallest total weight. For complete graphs (where every pair of vertices is joined by a single edge), we often use heuristic methods to find an upper bound and lower bound.
旅行商问题(TSP)是经典的优化问题:找出总权最小的哈密顿回路。对于完全图(任意两点间都有一条边相连),常采用启发式方法获取上界与下界。
Upper bound – Nearest neighbour algorithm: start at a chosen vertex, go to the nearest unvisited vertex, repeat, and finally return to the start. This yields a cycle quickly, but it is not guaranteed to be optimal. Both IB and CCEA accept displaying the upper bound by this method.
上界 – 最近邻算法:从选定顶点出发,前往最近的未访问顶点,重复此操作,最后返回起点。这样能快速得到一个回路,但不保证最优。IB 和 CCEA 都接受用此方法给出上界。
Lower bound – Deletion of a vertex: delete one vertex, find an MST of the remaining graph, and then add the lengths of the two shortest edges from the deleted vertex to the remaining vertices. The largest such lower bound found by trying all (or a selection of) vertices is taken as the best lower bound. The optimal tour length lies between the best lower bound and the smallest upper bound found.
下界 – 删除顶点法:删除一个顶点,求剩余图的最小生成树,然后加上从被删顶点到剩余顶点的两条最短边的长度。通过尝试所有顶点(或挑选几个)得到的最大下界即为最佳下界。最优回路长度介于最佳下界与找到的最小上界之间。
8. Graph Colouring and Scheduling | 图着色与调度问题
This topic appears primarily in IB Applications & Interpretation HL, where you may be asked to find the chromatic number of a graph (the minimum number of colours needed to colour vertices so that adjacent vertices have different colours) and apply it to scheduling problems.
该考点主要出现在 IB 应用与解释 HL 中,你可能需要求出一个图的色数(即相邻顶点不同色所需的最少颜色数),并将其应用于调度问题。
An important bound is that the chromatic number χ(G) ≤ Δ(G) + 1, where Δ(G) is the maximum vertex degree, though for many graphs the actual χ(G) is lower. For bipartite graphs, χ(G) = 2. The exam may ask you to colour a map by first converting it to a dual graph.
一个重要的上界是:色数 χ(G) ≤ Δ(G) + 1,其中 Δ(G) 是最大度数,但很多图的实际 χ(G) 会更小。对于二分图,χ(G) = 2。考试可能会让你先将地图转化为对偶图,再进行着色。
When scheduling, edges often represent conflicts: vertices with an edge between them cannot take the same time slot. The minimum number of time slots needed equals the chromatic number.
在调度问题中,边通常代表冲突:被边相连的顶点不能安排在同一时间段。所需的最少时间段数就是该图的色数。
9. Bipartite Graphs and Matchings | 二分图与匹配
A bipartite graph is one whose vertex set can be split into two disjoint sets, say X and Y, such that every edge connects a vertex in X to a vertex in Y. Many real‑life assignment problems are modelled this way, and the concept of a maximum matching – the largest set of edges with no common vertices – becomes crucial.
二分图是其顶点集可以分为两个不相交的子集 X 与 Y,且每条边都连接 X 中的一点与 Y 中的一点的图。许多现实生活中的指派问题都可用这种模型描述,最大匹配——即没有公共顶点的最大边集——这一概念变得至关重要。
CCEA Decision Mathematics 1 emphasises the Hungarian algorithm for finding maximum weight matchings in bipartite graphs, while IB might introduce the idea of alternating paths and augmenting paths to improve an initial matching. Both boards require understanding the vertex cover and matching relationship: in a bipartite graph, the size of a maximum matching equals the size of a minimum vertex cover (Kőnig’s theorem).
CCEA 决策数学 1 强调用匈牙利算法求二分图的最大权匹配,而 IB 可能会介绍交替路径与增广路径的概念,用以改进初始匹配。两个考试局都要求理解顶点覆盖与匹配的关系:在二分图中,最大匹配的基数等于最小顶点覆盖的基数(Kőnig 定理)。
Worked‑example approach: start with an initial matching, label unmatched vertices, and alternately reveal edges to find augmenting paths until no more improvements are possible.
解题思路:从初始匹配开始,对未匹配顶点进行标注,交替寻找增广路径,直到无法再改进为止。
10. Network Flows (CCEA Focus) | 网络流问题(CCEA 重点)
In CCEA Decision Mathematics, network flows deal with routing a commodity from a source node to a sink node through a directed network with capacity constraints. The objective is to find the maximum possible flow.
在 CCEA 决策数学中,网络流研究的是如何将有容量限制的有向网络中的某种“商品”从源点运送到汇点,目标是求出最大可行流量。
The Max‑Flow Min‑Cut Theorem states that the maximum flow equals the minimum cut capacity. A cut partitions the vertices into two sets, one containing the source and the other the sink; the cut capacity is the sum of capacities of edges going from the source set to the sink set.
最大流最小割定理指出:最大流等于最小割的容量。割将顶点划分为两个集合,一个包含源点,另一个包含汇点;割的容量是从源点集流向汇点集的边的容量总和。
Labelling procedure: repeatedly find flow‑augmenting paths from source to sink, increase flow along these paths as much as possible, and update residual capacities until no paths with spare capacity exist. Many exam questions ask you to verify an attempted flow by checking node equations (flow in = flow out at intermediate nodes) and capacity constraints.
标号过程:反复从源点到汇点寻找增流路径,尽可能增大路径上的流量,并更新剩余容量,直到不再存在可增流的路径。许多考题会要求你通过检查节点守恒(中间节点流入等于流出)及容量限制来验证某一尝试流量是否可行。
11. Exam Strategy and Common Pitfalls | 应试策略与常见误区
Graph theory questions can be deceptively straightforward, but losing marks through sloppy book‑keeping is common. Always show your working tables clearly. When using Prim’s or Dijkstra’s, write the order of edge/vertex selection; when colouring, list the vertices and colours explicitly. In TSP problems, recalculate both bounds even if one seems unnecessary – marks are often allocated for the demonstration of method.
图论题看似简单,但答题过程中因记录潦草而丢分的情况很常见。务必将计算表格清晰地呈现出来。使用 Prim 或 Dijkstra 算法时,写出边/顶点的选择次序;着色时,明确列出各顶点及对应颜色。在 TSP 题目中,即使某个界限看似多余,也要重新计算上下界——方法展示通常就是给分点。
Pay special attention to the definition of a graph in the question: is it directed or undirected, weighted or unweighted? Does it allow loops? In IB, failing to note that a graph is directed can lead to an incorrect adjacency matrix. In CCEA, forgetting to consider the possibility of parallel edges can invalidate your flow network analysis.
特别注意题意中对图的定义:是有向还是无向,加权还是无权?是否允许环?在 IB 中,忽略有向性就可能写错邻接矩阵;在 CCEA 中,忘记考虑多重边的可能性会使网络流分析无效。
When tackling route inspection, check the degrees carefully. A common mistake is to pair odd vertices without checking the actual shortest distances between them – always use Dijkstra (or inspection for small graphs) to find these shortest paths first.
在处理路线检查问题时,仔细检查各点度数。一个常见错误是随意配对奇度顶点,而没有先核实它们之间的实际最短距离——请始终先用 Dijkstra(或小图直接观察)求出这些最短路径。
Finally, practise past paper questions under timed conditions. Graph theory often presents long, multi‑step problems; managing your time and keeping your work logically structured will boost your confidence and your score.
最后,请计时练习往年真题。图论题往往包含多个步骤,过程较长;合理管理时间并保持解题步骤的逻辑结构,会大大提升你的信心和得分。
Published by TutorHao | Mathematics Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)