卷別
資料結構與演算法
選擇國立臺灣大學 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 , where is the set of vertices and is the set of edges (bonds).
- b) Initialize each vertex 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 , 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:
- Ester/acid branch on vertex 5:
- Carboxyl branch on vertex 10:
(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.