跳到主要内容

京都大学 情報学研究科 数理工学専攻 2017年8月実施 アルゴリズム基礎

Author

祭音Myyura

Description

連結単純無向グラフ G=(V,E)G=(V,E) と節点 sVs \in V が与えられたとき、ss を始点とする幅優先探索により得られる GG の全域木を TT とし、TT 上で ss からの距離 ii である節点の集合を ViV_i と記す。 以下の問いに答えよ。

(i) ss を始点として GG の全域木 TT を構築する幅優先探索の記述を与えよ。

(ii) j+2kj + 2 \leq k である VjV_jVkV_k の間には枝が存在しないことを証明せよ。

(iii) どの ViV_i も隣接する2節点の対を含まないとき、GG は二部グラフであることを証明せよ。

(iv) ある ViV_i が隣接する2節点の対を含むとき、GG は奇数長の閉路を持つことを証明せよ。

Kai

(i)

BFS-Tree(G, s):
V_T = {s}
E_T = {}
Q = {}
ENQUEUE(Q, s)

while Q is not empty do
u = DEQUEUE(Q)
for each v in Adj[u] do
if v is not in V_T then
V_T = V_T + {v}
E_T = E_T + {(u, v)}
ENQUEUE(Q, v)

return (V_T, E_T)

(ii)

If there exits an edge (u,v)(u, v) between VjV_j and VkV_k such that j+2kj+2 \leq k, w.l.o.g assume that uVju \in V_j and vVkv \in V_k, then the distance from ss to vv is at most

dist(s,v)dist(s,u)+dist(u,v)=j+1\text{dist}(s, v) \le \text{dist}(s, u) + \text{dist}(u, v) = j + 1

which contradicts dist(s,v)=kj+2\text{dist}(s,v) = k \geq j + 2.

(iii)

Consider the following sets:

X={vVii is even}Y={vVii is odd}\begin{aligned} X &= \{v \in V_i \mid i \text{ is even}\} \\ Y &= \{v \in V_i \mid i \text{ is odd}\} \end{aligned}

We show that there is no edge between two vertices both in XX, and also no edge between two vertices both in YY.

First, consider two different layers VjV_j and VkV_k with the same parity. If jkj \neq k, then

jk2|j-k| \ge 2

according to the result of question (ii), there is no edge between VjV_j and VkV_k.

Next, by the assumption, no ViV_i contains a pair of adjacent vertices. Hence no two vertices within the same set are adjacent, which implies that all edges of GG go between XX and YY, i.e., GG is a bipartite graph.

(iv)

We prove the statement by contradiction.

Suppose that some ViV_i contains a pair of adjacent vertices (u,v)(u,v). Since u,vViu, v \in V_i, the paths from ss to uu and from ss to vv in the BFS tree TT both have length ii.

Let PuP_u be the unique path from ss to uu in TT, and let PvP_v be the unique path from ss to vv in TT. Let ww be the last common vertex of these two paths. Suppose that wVlw \in V_l. Then the path from ww to uu in TT has length

ili - l

and the path from ww to vv in TT also has length

ili - l

Moreover, these two paths have no common vertices except ww. Therefore, by taking the path from ww to uu, then the edge (u,v)(u,v), and then the path from vv back to ww, we obtain a cycle.

The length of this cycle is

(il)+1+(il)=2(il)+1.(i−l)+1+(i−l)=2(i−l)+1.

which is an odd number.