1. Introduction
Maze-solving methods are important because they have practical applications and provide insight into the invisible intelligence that underlies them. Maze-solving problems can be regarded as a subset of the shortest path problem [
1], which is a practical problem in daily life. To solve the maze problem, a maze can be expressed as a network and then solved by an algorithm, such as the depth-first search or the breadth-first search algorithm [
2]. There are also maze-solving methods that exploit natural phenomena.
Such methods have been studied experimentally using the Belousov–Zhabotinsky reaction mixtures [
3], amoeboid organisms [
4], gas discharge [
5], and photons in a waveguide array [
6]. In these experiments, the result of maze-solving has a symbolic aspect in that it represents the autonomous optimization of the natural system. In this way, the pursuit and modeling of the optimization process in maze solving by a natural phenomenon, can provide a path to a deeper understanding of that phenomenon.
The quantum walk model, which has been studied as a quantum counterpart of random walk, has been applied to describe various transportation phenomena in nature [
7]. It was first studied as the time-evolution of probability distribution, mainly on a one-dimensional network. In the discrete-time quantum walk (DTQW) model, each node has a state vector of complex amplitudes whose dimension corresponds to the number of neighboring nodes. Each evolution is composed of a coin operation and a shift operation; after multiplying the unitary matrix (coin operation), the complex amplitude is transferred into an element of the state vector of a neighboring node (shift operation). By considering time-dependent or site-dependent unitary matrices, the quantum walk can express many kinds of transport dynamics.
The study of quantum walks was extended to arbitrarily connected networks from an early stage [
8] because the quantum search on graphs by quantum walks was proposed [
9,
10,
11] as an alternative to Grover’s search algorithm [
12]. When dealing with discrete-time quantum walks on an arbitrarily connected network, the concept of scattering quantum walks (SQWs) can simplify the model [
13].
In an SQW, the state vectors are placed on the edges rather than the nodes. The dimension of each state vector is two: this corresponds to the two directions of an edge between two nodes. Moreover, each node has a scattering matrix that corresponds to the unitary matrix in the coin operation. The time evolution is composed of an intrusion in the node, the multiplication of the scattering matrix, and an escape from the node. The dynamics of an SQW are equivalent to those of a DTQW except for the location of the state vectors.
Recently, the concepts of consecutive injection and corresponding emission into and from the system were incorporated into quantum walks on arbitrarily connected networks [
14,
15]. For quantum walks on a network with entrances and/or exits, the steady-state [
14], trapped-state [
15], analogy to an electrical circuit [
16], and relationship to the dressed photon phenomenon [
17] have been discussed. In particular, the emergence of a trapped state between two self-loops on a network with an exit sink [
15] directly motivated the present study, which applies this concept to maze-solving.
Maze-solving using quantum walks has been studied by Hillery, Koch, and Reitzner on an N-tree maze [
18] and a chain of stars [
19,
20]. Their works are the extension of their studies on quantum search and finding structural anomalies in networks [
21,
22,
23,
24,
25,
26,
27]. They characterized the start and goal nodes in the maze by reflection with phase inversion, which can be regarded as a pair of structural anomalies.
In this paper, we numerically examine a maze-solving method that uses a quantum walk on a network. The presented method is an application of the emergence of a trapped eigenstate on a network with sinks, and it provides an alternative to previously reported methods [
18,
19,
20]. Although the mathematical foundation of this method was given by Konno, Segawa, and Štefaňák [
28], the results presented here are non-trivial because the interaction among multiple trapped eigenstates and the initial condition is generally difficult to characterize as of now.
We show the effectiveness of the method for some examples of the maze with and without cycles and also show the undesirable cases for which this method does not work. The dependence of the number of steps for convergence (convergence steps) on the size of the network structure was also investigated and found to be counterintuitive in certain cases. We also make a tentative discussion about the amount of amplitude remaining on a path and its relative amount among the multiple paths from the numerical results.
2. Model and Method
In this study, the maze is composed of nodes and edges that connect pairs of nodes. The number of nodes is finite, but pairs of nodes can be connected arbitrarily without limit. The distance between two nodes is given by the smallest number of edges connecting them. Therefore, only distances expressed in positive integers are considered. The start and goal can be placed at any node in the network, even at nodes that are not dead ends. To run the quantum walk, scattering matrices and state vectors are placed on nodes and edges, respectively, as in previous studies on SQWs [
13].
The state vectors consist of two complex amplitudes, which express the two directions of the quantum walkers on the edges. As in quantum mechanics, the density of the walkers on an edge is given by the square of the complex amplitude. At each evolution of time, the vector of the incoming component is multiplied by the scattering matrix, generating the vector of the outgoing component. The scattering matrix of the
d-dimensional unitary matrix is placed at each node, where
d is the number of edges connected to that node. Specifically, we use the scattering matrix of the Grover walk, which, in concrete form, is given by
where
is the incoming complex amplitude from the
i-th edge, and b
is the outgoing complex amplitude to the
i-th edge. An example with
d = 3 is given in
Figure 1a.
To implement maze-solving, two self-loops and a sink are introduced, and the conceptual diagram is shown in
Figure 1b. Self-loops are the same as edges except that they are only attached to a single node. As a result, a self-loop has a one-dimensional state vector, where the outgoing amplitude from the node becomes the next incoming amplitude without being modified. For this method, one self-loop is attached to the start node, and the other is attached to the goal node to which a sink node is also attached. The sink node has only one edge, which is connected to the goal node, and its scattering matrix is a zero matrix. The sink serves as the exit from the network for complex amplitudes.
The initial amplitude “1” is placed at the self-loop of the start node. To discover the correct path, the initial amplitude should be placed on the path between the start and goal, and it should be kept at a distance from the sink node. In this method, placing the localized amplitude at the self-loop of the start node is the best initial condition for solving the maze correctly without requiring any prior knowledge of the structure of the maze. Finally, note that all the amplitudes in the system are denoted by the real numbers even though the quantum walks are defined using complex amplitudes.
Maze solving was studied for simple structures only because of the large amount of computational time involved by the current code (by the current code on our standard personal computer, the calculation of 10 steps took several hours because of unoptimized function–call overhead). For the maze without a cycle, a tree-like structure and a single line with branches were investigated. For the maze with a cycle, independent multiple paths and a ladder-like structure were investigated.
Two undesirable cases, namely, a maze with odd cycles and a maze showing eternal vibration are also investigated. For each kind of structure, the dependence of convergence steps on the size of the structure was investigated. The convergence was judged by the stability of the second decimal place for all the amplitudes in the network, and the convergence steps were expressed with an accuracy of one (or two) significant digits.
For discussion regarding the amount of amplitude remaining, about five digits after the decimal point were considered. The numerical error estimated from the squared sum of the amplitudes was of nearly the same order as the double-precision real number error computed using code written in Python. The source code is available in the repository [
29].
4. Discussion
In applying the proposed method to mazes without odd cycles, we verified that the paths between the start and goal emerge as trapped states of the quantum walk, and the density on the shortest path was maximized autonomously. As the network without odd cycles is regarded as a bipartite graph, we concluded that the method can be applied to the bipartite graph except for the case where the eternal vibration emerges. The condition for the occurrence of the eternal vibration is not clear as of now as only a few examples were considered.
The key features of the proposed method are the self-loops at the start and the goal and the sink node attached to the goal. In previous studies, the start and goal were marked by reflection with phase inversion placed at the dead ends [
18,
19,
20]. The correct path was then judged by the transient profile of the probabilities. Our method partially improves upon past works by incorporating self-loops, which can be placed anywhere in the maze, and by determining the correct path according to the eternally remaining densities.
We now consider the remaining densities on the correct path in terms of knowledge that has been proven mathematically. The eigenstate of the time evolution operator of the quantum walk with sinks was constructed on the path between two-self loops [
28]. This eigenstate is called the trapped state, and it is not absorbed by the sink. In the Grover walk, the eigenstates are constructed between two self-loops and also around the cycles [
28].
To generate a trapped state, the initial amplitude should be placed on the edge that is to be included in the trapped state. This was the reason why the initial amplitude was placed on the self-loop of the start node. If the initial amplitude is placed randomly at the edge, the trapped state on the correct path does not always emerge because the initial edge may not be included on the path between the start and the goal. Even if the initial state is on the correct path, a trapped state may also emerge in the cyclic structure that includes the initial edge. In this case, the shortest path may not have the maximum density. When placing the initial amplitude on a self-loop, the initial edge is not included in any cyclic structure in the network, and only the paths between the start and the goal emerge.
The role of the sink should also be considered. The dynamics of this type of Grover walk can be separated into an electric current component that propagates rapidly, and a random-walk component that propagates slowly [
16]. The emergence of the trapped state results from the electric current component; hence, to observe the trapped state, the random-walk component must be eliminated by the sink.
Even without the mathematical knowledge above, the amplitude distribution after convergence can be interpreted by the simple rules observed in the numerical results. The key rule for determining amplitude distribution is that the sum of incoming/outgoing amplitudes to/from a node must be zero, separately. This rule is mathematically and numerically exact at all the nodes in the examples that converged.
Figure 9a shows an example of amplitude distribution around a node on the correct path in the maze.
As the sum of incoming and outgoing amplitudes should be zero separately, amplitudes of plus and minus emerge alternately on the line.
Figure 9b shows an example of an amplitude distribution around a dead-end node. As only one amplitude is incoming to the dead-end node, that should be zero to make the sum of the incoming amplitude zero. This is why the amplitudes vanish on the path to the dead-end.
Figure 9c shows an example of amplitude distribution around a self-loop. In this case, the amplitude on the self-loop acts as both incoming and outgoing amplitudes to keep the sum zero for both. This is the reason why the signs of the amplitudes are the same on the edges connected to the node involving the self-loop. These facts fit all the nodes included in the numerical results after convergence.
The sum rule above can be used to also explain the amplitude distribution around the even cycle and odd cycle.
Figure 9d shows an example of the amplitude distribution around an even cycle. When the large positive amplitude enters the cycle, two small negative amplitudes are generated at the first branching node. Both amplitudes move on the cycle by changing the sign alternately and meet again on the join node. If the cycle is an even cycle, two small negative amplitudes make a large positive amplitude to the outside of the cycle to keep the sum rule. For the case of an odd cycle (
Figure 9e), two amplitudes meet at the join node with different signs. To maintain the sum rule, only the smaller amplitude, which is nearly zero, generates the output. This is the reason why the maze, including the odd cycle, cannot be solved by this method.
The maze-solving speed of this method is clearly considerably slower than that of other known algorithms. Although the examples were limited, the convergence steps were difficult to predict by intuition in observing the structure of the network. At present, the intuitive unified parameter that connects the network structure and convergence speed has not been determined mathematically. Further analysis, considering some other aspect, such as the symmetry of the graph, may be required.
The general reason that the maximum densities emerge on the shortest path remains unclear at present; however, some tentative rules were observed numerically. In many cases, the absolute values of amplitude that remained could be approximated to a rational number composed of integers. When there is only one path to the goal, the absolute values of amplitudes on an edge become the inverse number of the number of edges included in the path. This is observed in
Figure 2,
Figure 3,
Figure 4a and
Figure 5a. The preserved amount is not the square of the amplitude but the absolute value of amplitude. It is the same as the sum rule discussed above.
When there are multiple paths to the goal and they do not share edges mutually, the ratio of the absolute values of amplitudes is in inverse proportion to the ratio of the distance of the paths. This is observed in
Figure 4b–f. When there are two paths to the goal and they share some edges, the ratio of the absolute values of amplitudes is in inverse proportion to the ratio of the distance of the non-shared part of the paths. This is observed in
Figure 6a,c. When there are more than two paths to the goal and they share some edges, the dependence of the relative amount of amplitudes on the distance is unclear; however, certain rules clearly exist. This was seen in
Figure 5b,d.
To apply the method presented for actual problems of the shortest path finding, the lengths of all the paths should be expressed by positive integers. The odd-loops must not be included; however, the odd-loops would be eliminated by a slight modification of the distance in the process of discretization of the network. The eternal vibration is still the obstacle of the path-finding problem. This should be analyzed more both mathematically and numerically. Additionally, this method cannot involve the negative distance that is considered in some classical algorithms.
Studying this maze-solving method may not appear to be of much use from the viewpoint of computational algorithms; however, it may help to understand the mechanisms of autonomous features that can be observed in a natural system because the quantum walk is a toy model that can be applied to the energy transportation in quantum fields, such as dressed photon phenomena [
30].
While the emergence of the shortest path or some other optimized structure in a natural phenomenon may seem mysterious at first glance, they may have an analogy in maze-solving using the quantum walks. Moreover, the implicit existence of the sink node may play an important role in such systems.