← 回題庫

卷別

資料結構與演算法

選擇

國立臺灣大學 2025 · 考試 · 第 5 題

考科演算法

(5 points) Graph theory can be used to find the numbering of a chemical structure; a possible one can be used according to the following steps:

  • a) Represent the molecule as an undirected graph G=(V,E)G = (V, E), where VV is the set of vertices and EE is the set of edges (bonds).
  • b) Initialize each vertex v∈Vv \in V with a value equal to its degree (number of incident edges).
  • c) For a fixed number of iterations or until convergence: (i) for each vertex vv, compute a new value as the sum of the current values of its neighbors (not including itself); (ii) update all vertex values simultaneously.
  • d) After the iterations, sort the vertices based on their final values in non-increasing order, ties breaking with smaller labels.

Consider the following 2-Carboxyoxybenzoic acid structure represented as a graph (numbers in parentheses are temporary labels for reference, not the final numbering). The graph has 13 vertices connected by the following bonds:

  • Six-membered ring: 5–6, 6–7, 7–8, 8–9, 9–10, 10–55\text{–}6,\ 6\text{–}7,\ 7\text{–}8,\ 8\text{–}9,\ 9\text{–}10,\ 10\text{–}5
  • Ester/acid branch on vertex 5: 5–4, 4–3, 3–1, 3–25\text{–}4,\ 4\text{–}3,\ 3\text{–}1,\ 3\text{–}2
  • Carboxyl branch on vertex 10: 10–11, 11–12, 11–1310\text{–}11,\ 11\text{–}12,\ 11\text{–}13

(Vertices 1, 2, 12, 13 are oxygen leaves; 3 and 11 are the carboxyl/ester carbons; 4 is the bridging ester oxygen; 5–10 form the ring. Double bonds do not affect the simple-graph degree.)

Apply the above algorithm for two iterations on this graph. What is the correct ordering of the vertices after these iterations?

  • (A)
    5, 6, 10, 11, 9, 4, 3, 7, 8, 12, 13, 1, 2
  • (B)
    5, 6, 10, 11, 9, 3, 4, 7, 8, 12, 13, 1, 2
  • (C)
    5, 6, 10, 11, 3, 4, 9, 7, 8, 12, 13, 1, 2
  • (D)
    5, 10, 11, 6, 9, 3, 4, 7, 8, 12, 13, 1, 2
  • (E)
    None of the above choices.

標準解析

AI 已複查