Cameron 等人最近提出了一個演算法,在 O(1) 平均分攤時間列舉扇形圖的所有生成樹。生成樹的列舉滿足樞軸 (pivot) 格雷碼特性,因此連續的樹透過某個頂點旋轉單個邊而不同。他們也提出了使用 O(n) 的時間及 O(n) 空間對列舉中的生成樹進行排位與反排位的演算法。本論文我們首先觀察扇形圖的所有生成樹都可以自然地利用整數序列表示,因此它們的編碼樹具有規律性。然而,我們提出了一個簡單的演算法,根據這些屬性在 O(1) 的平均分攤時間依字典次序列舉其生成樹整數序列。根據字典次序,我們也提出了使用 O(n) 時間及 n + O(1) 空間 (空間的大小略大於n) 的排位與反排位演算法。此外,我們也提出了無迴圈演算法在 O(1) 的時間列舉生成樹整數序列,記憶體空間為3n + O(1)。
Cameron et al. [27th Int. Conf. Computing and Combinatorics (COCOON 2021), LNCS 13025, pp.49-60] recently presented an algorithm for generating all spanning trees of a fan graph in O(1)-amortized time. The listing of spanning trees fulflls the so-called pivot Gray code property so that successive trees differ by pivoting a single edge around a vertex. They also presented algorithms for ranking and unranking a spanning tree in the listing in O(n) time using O(n) space. In this thesis, we first observe that all spanning trees of a fan graph can be naturally represented by integer sequences so that their coding tree has properties with regularity. Then, we propose a simple algorithm for generating spanning-tree sequences in lexicographic order in O(1)-amortized time according to these properties. Additionally, based on the lexicographic order, we develop ranking and unranking algorithms in O(n)-time using n+O(1) space (i.e., the size of the space is just slightly larger than n). In addition, we also design a loopless algorithm for generating in O(1)-time using 3n + O(1) space