東京大学 情報理工学系研究科 コンピュータ科学専攻 2020年8月実施 専門科目 問題1
Author
zephyr, 祭音Myyura
Description
In undirected graphs, a self-loop is an edge connecting the same vertex, and multi-edges are multiple edges connecting the same pair of vertices. From now on, we consider undirected graphs without self-loops and possibly with multi-edges. We say that a graph is an -graph if a graph consisting of a single edge can be obtained from by repeatedly applying the following two operations.
B-operation
When two multi-edges connect a pair of vertices, replace the multi-edges with a single edge connecting the pair of vertices.
C-operation
When one edge connects vertices and , another edge connects and (where ), and there is no other edge incident to , remove the vertex and replace the two edges with a new edge connecting and .
Answer the following questions.
(1) Let be a complete graph of vertices. Answer whether each of and is an -graph or not.
(2) Show that every -graph is planar.
(3) Give the maximum number of edges of an -graph with vertices without multi-edges, with a proof. Also, give such an -graph attaining the maximum for general , with an explanation.
(4) Give an -time algorithm which, given an undirected graph with vertices and edges as an input, determines whether it is an -graph or not. Explain also the graph data structures used in the algorithm for realizing -operations and -operations.
题目描述
无向图中的自环连接同一顶点,重边是连接同一对顶点的多条边。以下考虑不含自环、但可含重边的无向图。若从图 出发反复执行下列操作,最终可以得到只含一条边的图,则称 为 A-图:
- B 操作:若一对顶点间有两条重边,则将它们替换为连接该顶点对的一条边;
- C 操作:若边 与 相接,,且没有其他边与 关联,则删除 ,并用一条连接 的新边替换原两条边。
回答下列问题。
(1)记 为 个顶点的完全图。分别判断 和 是否为 A-图。
(2)证明每个 A-图都是平面图。
(3)对不含重边、具有 个顶点的 A-图,求其最大边数并证明;同时对一般 给出达到该上界的 A-图并作说明。
(4)给出一个 时间算法,输入具有 个顶点、 条边的无向图,判断它是否为 A-图;同时说明为在线性时间内实现 B、C 操作所采用的图数据结构。
Kai
(1)
: The complete graph consists of three vertices and three edges, forming a triangle. Since there are no multi-edges, the -operation does not initially apply. Each vertex has degree two, so apply a -operation to any vertex. The two remaining vertices are then joined by two parallel edges; one -operation leaves a single edge. Therefore, is an -graph.
: The complete graph consists of 4 vertices and 6 edges, forming a tetrahedron. Similar to , there are no multi-edges, so the -operation does not apply. For the -operation, we need a vertex with exactly two incident edges. In , each vertex is connected to three others, so we cannot directly apply the -operation. Hence, is not an -graph.
(2)
Read a reduction sequence backwards, starting from a planar drawing of one edge. The inverse of a B-operation adds a parallel edge, which can be drawn beside the existing edge. The inverse of a C-operation subdivides an edge by a degree-two vertex. Both preserve planarity, so the original A-graph is planar.
(3)
The maximum is
Starting from a simple graph, apply each necessary B-operation immediately after a C-operation. Every C-operation decreases the vertex count by one and can create at most one parallel pair. There are C-operations, hence at most B-operations. If their number is , edge counting gives
so .
The bound is attained by taking an edge and further vertices, each adjacent to both and . Suppressing each such vertex and then merging the resulting parallel edge reduces the graph to ; it has edges.
(4)
-
Merge all parallel edges by -operations.
-
Store the resulting graph in mutable adjacency lists. Maintain the current degree of each vertex, a queue of degree-two vertices, and a hash table keyed by unordered endpoint pairs.
-
While the queue is nonempty, remove a degree-two vertex with neighbors . Delete and insert unless the hash table already contains it; in the latter case the insertion and the following -operation cancel. Update the degrees of and enqueue either one when its degree becomes two.
-
Accept exactly when two vertices and one edge remain.
Each vertex is removed once and each edge is inserted or deleted times. Hash-table lookup and update take expected time, so the total time and space are .
Knowledge
图论 平面图 算法
难点解题思路
识别和应用 和 操作是确定 -图的关键。对于复杂图的处理,可以通过维护邻接表和度列表来优化操作。
解题技巧和信息
对于确定图的性质问题,特别是涉及特定操作的图,可以通过模拟操作并逐步简化图结构来判断。理解操作对图结构的影响是关键。
重点词汇
- Self-loop 自环
- Multi-edges 多重边
- Planar 平面
- Complete graph 完全图
- Algorithm 算法
参考资料
- "Introduction to Graph Theory" by Douglas B. West, Chapter 4
- "Graph Theory" by Reinhard Diestel, Chapter 5