跳到主要内容

東京大学 情報理工学系研究科 コンピュータ科学専攻 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 G\mathbf{G} is an A\mathbf{A}-graph if a graph consisting of a single edge can be obtained from G\mathbf{G} 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 u\mathbf{u} and v\mathbf{v}, another edge connects v\mathbf{v} and w\mathbf{w} (where uw\mathbf{u} \neq \mathbf{w}), and there is no other edge incident to v\mathbf{v}, remove the vertex v\mathbf{v} and replace the two edges with a new edge connecting u\mathbf{u} and w\mathbf{w}.

Answer the following questions.

(1) Let Kn\mathbf{K}_n be a complete graph of n\mathbf{n} vertices. Answer whether each of K3\mathbf{K}_3 and K4\mathbf{K}_4 is an A\mathbf{A}-graph or not.

(2) Show that every A\mathbf{A}-graph is planar.

(3) Give the maximum number of edges of an A\mathbf{A}-graph with n\mathbf{n} vertices without multi-edges, with a proof. Also, give such an A\mathbf{A}-graph attaining the maximum for general n\mathbf{n}, with an explanation.

(4) Give an O(m+n)\mathbf{O(m + n)}-time algorithm which, given an undirected graph with n\mathbf{n} vertices and m\mathbf{m} edges as an input, determines whether it is an A\mathbf{A}-graph or not. Explain also the graph data structures used in the algorithm for realizing B\mathbf{B}-operations and C\mathbf{C}-operations.

题目描述

无向图中的自环连接同一顶点,重边是连接同一对顶点的多条边。以下考虑不含自环、但可含重边的无向图。若从图 GG 出发反复执行下列操作,最终可以得到只含一条边的图,则称 GG 为 A-图:

  • B 操作:若一对顶点间有两条重边,则将它们替换为连接该顶点对的一条边;
  • C 操作:若边 (u,v)(u,v)(v,w)(v,w) 相接,uwu\ne w,且没有其他边与 vv 关联,则删除 vv,并用一条连接 u,wu,w 的新边替换原两条边。

回答下列问题。

(1)记 KnK_nnn 个顶点的完全图。分别判断 K3K_3K4K_4 是否为 A-图。

(2)证明每个 A-图都是平面图。

(3)对不含重边、具有 nn 个顶点的 A-图,求其最大边数并证明;同时对一般 nn 给出达到该上界的 A-图并作说明。

(4)给出一个 O(m+n)O(m+n) 时间算法,输入具有 nn 个顶点、mm 条边的无向图,判断它是否为 A-图;同时说明为在线性时间内实现 B、C 操作所采用的图数据结构。

Kai

(1)

K3\mathbf{K}_3: The complete graph K3\mathbf{K}_3 consists of three vertices and three edges, forming a triangle. Since there are no multi-edges, the B\mathbf{B}-operation does not initially apply. Each vertex has degree two, so apply a C\mathbf{C}-operation to any vertex. The two remaining vertices are then joined by two parallel edges; one B\mathbf{B}-operation leaves a single edge. Therefore, K3\mathbf{K}_3 is an A\mathbf{A}-graph.

K4\mathbf{K}_4: The complete graph K4\mathbf{K}_4 consists of 4 vertices and 6 edges, forming a tetrahedron. Similar to K3\mathbf{K}_3, there are no multi-edges, so the B\mathbf{B}-operation does not apply. For the C\mathbf{C}-operation, we need a vertex with exactly two incident edges. In K4\mathbf{K}_4, each vertex is connected to three others, so we cannot directly apply the C\mathbf{C}-operation. Hence, K4\mathbf{K}_4 is not an A\mathbf{A}-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

2n3(n2).\boxed{2n-3}\qquad(n\ge2).

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 n2n-2 C-operations, hence at most n2n-2 B-operations. If their number is bb, edge counting gives

m(n2)b=1,m-(n-2)-b=1,

so m2n3m\le2n-3.

The bound is attained by taking an edge uvuv and n2n-2 further vertices, each adjacent to both uu and vv. Suppressing each such vertex and then merging the resulting parallel edge reduces the graph to uvuv; it has 1+2(n2)=2n31+2(n-2)=2n-3 edges.

(4)

  1. Merge all parallel edges by B\mathbf{B}-operations.

  2. 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.

  3. While the queue is nonempty, remove a degree-two vertex vv with neighbors u,wu,w. Delete uv,vwuv,vw and insert uwuw unless the hash table already contains it; in the latter case the insertion and the following B\mathbf{B}-operation cancel. Update the degrees of u,wu,w and enqueue either one when its degree becomes two.

  4. Accept exactly when two vertices and one edge remain.

Each vertex is removed once and each edge is inserted or deleted O(1)O(1) times. Hash-table lookup and update take expected O(1)O(1) time, so the total time and space are O(m+n)O(m+n).

Knowledge

图论 平面图 算法

难点解题思路

识别和应用 B\mathbf{B}C\mathbf{C} 操作是确定 A\mathbf{A}-图的关键。对于复杂图的处理,可以通过维护邻接表和度列表来优化操作。

解题技巧和信息

对于确定图的性质问题,特别是涉及特定操作的图,可以通过模拟操作并逐步简化图结构来判断。理解操作对图结构的影响是关键。

重点词汇

  • Self-loop 自环
  • Multi-edges 多重边
  • Planar 平面
  • Complete graph 完全图
  • Algorithm 算法

参考资料

  1. "Introduction to Graph Theory" by Douglas B. West, Chapter 4
  2. "Graph Theory" by Reinhard Diestel, Chapter 5