Recursively Divided Pancake Graphs with a Small Network Cost

: Graphs are often used as models to solve problems in computer science, mathematics, and biology. A pancake sorting problem is modeled using a pancake graph whose classes include burnt pancake graphs, signed permutation graphs, and restricted pancake graphs. The network cost is degree × diameter. Finding a graph with a small network cost is like ﬁnding a good sorting algorithm. We propose a novel recursively divided pancake (RDP) graph that has a smaller network cost than other pancake-like graphs. In the pancake graph P n , the number of nodes is n !, the degree is n − 1, and the network cost is O ( n 2 ). In an RDP n , the number of nodes is n !, the degree is 2log 2 n − 1, and the network cost is O ( n (log 2 n ) 3 ). Because O ( n (log 2 n ) 3 ) < O ( n 2 ), the RDP is superior to other pancake-like graphs. In this paper, we propose an RDP n and analyze its basic topological properties. Second, we show that the RDP n is recursive and symmetric. Third, a sorting algorithm is proposed, and the degree and diameter are derived. Finally, the network cost is compared between the RDP graph and other classes of pancake graphs.


Introduction
The pancake graphs originated with pancake sorting problems.An n-pancake sorting problem refers to the task of sorting n pancakes of varied sizes piled on a stack.The stacked states are represented as permutations of the set {1, . . ., n}.The operation of reversing the positions of the pancakes from the top to the k-th pancake is called prefix reversal (flip hereinafter).A flip, therefore, changes the positions of the first k (1 < k ≤ n) pancakes.When sorting is finished, symbol 1 is positioned at the top, and symbol n at the bottom [1].The solution to this problem is as follows.First, put the largest pancake on the top, and then take it down to the bottom, then repeat this iteration with the rest of the pancakes n − 2 times.Simply put, the number of flips in order to complete the sort in the worst time complexity is 2n − 3. W. Gates suggests a method in which the number of required flips is 1.6666n and the lower bound is proved to be 1.0625n (n≡0(mod 16)) [2], while B. Chitturi suggests a method in which the number of flips is 1.6363n and the lower bound is proved to be 1.071n (n ≡ 0(mod 16)) [3].
The n-pancake sorting problem can be represented by the pancake graph P n .The permutations are mapped to the nodes and flips to the edges.The number of nodes in P n is n, and the degree is n − 1.The operation that flips the kth pancake is flip k .In graph theory, the degree of a node is the number of edges incident with the node.The degree of a graph represents the maximum degree of all nodes.The distance between two nodes, u and v, is the number of edges of the shortest path between u and v.The diameter is the maximum distance between all pairs of nodes [4].
Time complexity is a measure used to evaluate sorting algorithms.It refers to the number of times the main operations are performed so that the algorithm can terminate.There are three main operations for sorting the permutations, as is the case for the classes of star or pancake graphs: reversals (flips) that flip the order of symbols, transpositions that move the symbols to other positions, and translocations that exchange two symbols with each other.
Direct comparison of sorting algorithms using these three operations is difficult, because the given main operations all differ.Suppose we are given an arbitrary node, S = s 1 s 2 s 3 . . .s n−2 s n−1 s n .Then, the main operation of a star graph exchanges s 1 and s k (1 < k ≤ n).However, the main operation of a pancake graph is the flip.The sorting time complexity of a star graph S n is 1.5n, and that of a pancake graph P n is 1.67n [5].Thus, it is not reasonable to simply compare the time complexities of these algorithms.In an extreme case, if there is a graph wherein all symbols can move to all positions, the time complexity is n − 1.However, it cannot be said that this sorting algorithm is effective.When evaluating time complexity, the number of main operations must also be evaluated.
When a sorting problem is expressed as a graph, the number of main operations is mapped to the degree and the worst time complexity to the diameter.The network cost is degree × diameter.The network cost is the sorting cost of the sorting algorithm.If an edge is added to the graph, the degree increases, and the diameter decreases.Conversely, if an edge is removed, the degree decreases and the diameter increases.These two factors provide a trade-off.Therefore, it is difficult to reduce network costs [6].The degree of a pancake graph is n − 1, and the network cost is O(n 2 ).We propose an RDP that reduces the degree to O(log 2 n) and the network cost to O(log 2 n 3 ) by using recursively divided edges.
Pancake-like graphs have been studied for sorting problems [2,3,[7][8][9][10], interconnection networks in computer science [11][12][13][14][15][16], and DNA computing models in biology [17][18][19][20][21]. Finding a graph with a small network cost is like a high-performance interconnection network and a good sorting algorithm [22].The burnt pancake problem involves the sorting of pancakes that are burnt on one side in order of their size.W. Gates proved that the lower bound for the number of flips is 1.5n and the upper bound is 2n + 3 in the sorting of n burnt pancakes [2].D. Cohen proved that the lower bound for the number of flips (n ≥ 10) is 1.5n and the upper bound is 2n − 2 [23].V. Bafna introduced research on the sorting permutations to the genes of animals and plants in order to translate between two permutations [24].P. Berman proposed an algorithm that completes a sort 1.375n number of flips [17].A signed permutation by reversal (SBR) is a problem that involves the sorting of permutations that consist of an integer between −n and n, excluding 0. S. Hannenhalli proposed an algorithm in which the upper bound of the number of flips is O(n 2 ) [18].The result of the research in this paragraph is introduced in [6].
In this paper, we propose an RDP graph that has a lower network cost than pancakelike graphs.In Section 2, the notations used throughout the paper are described, and the RDP is defined.In Section 3, we analyze the properties of the RDP.In Section 4, a sorting algorithm is introduced, and diameters and network costs are analyzed and compared.Finally, Section 5 presents the conclusions.

Preliminaries and Definition of Recursively Divided Pancake
This section provides the definitions used in this paper, and a recursively divided pancake RDP n is described.
An RDP divides the symbols in half and performs a flip operation using edges.These edges are generated recursively.In flip k , the pancake graph is For a node address of RDP n , a permutation of natural numbers from 1 to n is used.Let an arbitrary node, S = s 1 s 2 s 3 . . .s k−1 s k s k+1 . . .s n−2 s n−1 s n , exist.Definition 2 defines the flip operation and, in Definition 3, symbol s k at the kth position is moved to the top.The symbols that should be carefully considered throughout this paper are written in blue.Definition 1. s k is the kth symbol or position k symbol.|S| denotes the number of symbols.

Definition 3. The moving operation for s k to the top is MTF
The definition of a recursively divided pancake RDP n is as follows: , where m is the natural number.
A path can be expressed as a node sequence from the start node to the destination node.Here, a neighboring node is connected by an edge.The paths are represented as follows: Notation 1. → is used to indicate a path.For example, the paths between 1234, 2134, 3124, and 4213 in Figure 1

Topological Properties
In this section, the basic topological properties and the recursive expandability of the RDP are examined.Then, we prove that it is a connected graph.Theorem 1. RDP n is a regular graph with a degree of 2log 2 n − 1, and the number of nodes is n!.The number of edges is n!log 2 n − 0.5n.
Proof.Because the node addresses of RDP n are permutations of natural numbers from 1 to n, the total number of nodes is n!.The number of edges FE connected to an arbitrary node is 2log 2 n − 1.Because every node has the same number of edges, RDP n is regular, and the degree is 2log 2 n − 1.Because it is an undirected graph, the total number of edges is For a graph to be expanded recursively, two conditions must be satisfied.First, the expansion rules must be consistent.Second, the graph of level n must contain a graph of level n − 1. Recursive graphs are favorable for sorting algorithms, broadcasting algorithms, and algorithms for path problems, because the algorithm at the n − 1 level is used the same way as in an algorithm at level n.

Theorem 2. RDP n expands recursively.
Proof.First, nodes are examined, after which the edges are explained.Here, |RDP n | is the number of nodes in RDP n .In RDP n , the number of nodes increases as the level increases based on the following method: Therefore, |RDP n | is defined recursively as follows: Let us now examine the edges.If all nodes are connected in a graph, it is a connected graph that has a path from an arbitrary node to every other node.A node address is comprised of permutations.If a symbol that forms a permutation can be moved to any position, then all permutations are connected to each other.If a symbol, s 1 , can be moved to any other position, those of all positions can also be moved to s 1 .This ensures that all symbols can be moved to any position.It is well known that a permutation (e.g., a star graph) is a symmetry group [11].Symmetry groups are automorphic.Because the nodes of RDP n are permutations, the proof of node transitivity is omitted in the proof of Theorem 4. Theorem 4. RDP n is a symmetric graph.
Proof.Only the edge transitivity is proved.Let an arbitrary node be s = s 1 s 2 s 3 . . .s k . . .
The mapping function, f, is a bijection, which can be any function that exchanges symbols.The edge, FE k , is denoted by (s, t).It is shown that f(s) and f(t) are connected to each other.
Thus, f (s) and f (t) are connected to FE k .Therefore, RDP n is a node-and edge-transitive graph and is symmetric.

Sorting Algorithm and Network Cost Comparison
In this section, we first present a sorting algorithm.Subsequently, the diameter is derived to calculate the network cost.Then, the network cost is compared to that of other pancake-like graphs.
Let us assume that a start node is u, and a destination node is v.A sorting algorithm is a rule that generates a sequence of nodes from u to v.In other words, it changes the address of the start node to that of the destination node by using the flip operator, FO k .If the destination node v = 1234 . . .n, then it is a sorting algorithm.
A rough overview of sorting is as follows.First, the symbols of u are divided into two bundles, uf and ur, as shown in Figure 3.Then, symbols 5 and 6 in uf are exchanged with symbols 1 and 2 in ur.When this step is completed, uf and vf comprise the same symbols.This is also true for ur and vr.If the above process is repeated in uf and ur until the number of symbols becomes 1, u will be the same as v.In the sorting algorithm, <pre-work> defines several factors.In particular, it defines the symbols that should be exchanged between uf and ur.In Figure 3, 56 and 12 are symbols that should be exchanged.Let the start node be u = u 1 u 2 u 3 . . .u k-1 u k u k + 1 . . .u n−2 u n−1 u n , and the destination node be In the address of node u, a set uf = {u 1 ,u 2 ,u 3 , . . ., u n/2 } and a set ur = {u n/2+1 , . . .u n }.In the case of node v, vf = {v 1 ,v 2 ,v 3 , . . ., v n/2 } and vr = {v n/2+1 , . . .v n }.
In Figure 3 The sorting algorithm in Algorithm 1 is performed recursively until |uf | = |ur| = 1.The sorting algorithm is as follows: = = is an equality operator, and = is an assignment operator.The Algorithm 2 exchanges symbols based on the following method.
Move the first symbol to be exchanged to u 1 via MTF().Flip a half through FO n/2 .Flip the whole thing through FO n .Move the second symbol to be exchanged to u 1 via MTF().Exchange u 1 and u (n/2) + 1 with each other through FO n + 1 .
The diameter is the distance between the two farthest nodes in the graph.The diameter is an important measure for evaluating a graph, and, in the worst case, it is the sorting time complexity.It represents the software cost when the graph is implemented in a system.Theorem 5.The diameter of RDP n is 0.5n(log 2 n) 2 + nlog 2 n.
Proof.The diameter analysis is substituted by finding the worst-case time complexity of the sorting algorithm.The number of calls, a, of sorting(u) is called recursively as follows: |u| and |v| are reduced by half each time the function is called, and the function is terminated when the size becomes one.Therefore, a = log 2 n.In the worst case, the number of symbols exchanged is b = n/2 when the function is called once in the sorting algorithm.The operations required to exchange two symbols with each other are MTF() and FO, which are performed twice and thrice, respectively.If the number of exchanged symbols is odd, FO is required only once.The number of times MTF() is executed for a symbol is log 2 n in the worst case.The number of operations required to exchange the two symbols is c = 2log 2 n + 3 + 1.
The diameter, k = a × (bc)/2, where a is the number of times that sorting() is called, and (bc)/2 is the internal time complexity of sorting().
Network cost is an important measure for evaluating graphs.Table 1 shows the network cost of RDP n vs. various pancake-like graphs.The diameter and degree of pancake [2,10], restricted pancake [6], burnt pancake [1,2], restricted burnt pancake [6], and signed permutation [8,10] have been presented in a previous study [6].The network cost is shown by the Big-O notation.Because O((log 2 n) 3 ) < O(n 2 ), RDP is superior to other pancake-like graphs as shown in Table 1 in terms of network cost.

Conclusions
Pancake-like graphs are used in various fields wherein network cost is an important evaluation measure.We have provided an RDP that has a smaller network cost than existing pancake-like graphs.In RDP n , the number of nodes was n!, the degree was 2log 2 n − 1, and the diameter was 0.5n(log 2 n) 2 + nlog 2 n.The network cost of RDP n was O((log 2 n) 3 ).we propose an RDP that has a lower network cost than pancake-like graphs.The pancake-like graphs have been studied for sorting problems, interconnection networks, and DNA computing models.We hope that RDP will be used as a model to solve problems in various fields.We analyzed the topological properties of the RDP and connected graphs and proposed a more efficient sorting algorithm.It is expected that various algorithms, such as broadcasting, parallel path, spanning tree, and embedding algorithms, can be improved based on this graph in the future.Time complexity is a measure used to evaluate sorting algorithms.It refers to the number of times the main operations are performed so that the algorithm can terminate.I wonder if it is correct to compare sorting algorithms using only time complexity.I think the number of main operations can also be included in the evaluation.I think this idea needs more discussion.
Figure 2 provides arrows to indicate the positions that can be flipped in the node addresses for RDP 2 , RDP 4 , RDP 8 , and RDP 16 from left to right.See the red arrows.Even if the level increases, the flip position of the previous level remains intact.In other words, RDP n maintains the edges of RDP n−1 as they are.See the green arrows.As the level increases, edges are added at positions n/2 + 1 and n recursively.Therefore, RDP n expands recursively.
The function exchange() in Algorithm 2 exchanges fdif in uf with rdif in ur.If exchange() is executed once, then there is no additional symbol exchange with uf and ur.

Table 1 .
Comparison of network cost with other classes of pancake graphs.