Introduction

A class of famous complexity problems known as NP-complete problems1,2 consists of such tasks as the traveling salesman problem that aims to find the shortest possible route on a map,1,3 the satisfiability task of determining a Boolean interpretation of the formula2 and the real-word ‘clique problem’ of graph theory for finding the largest subset of people who all know each other.4 Importantly, different NP-complete problems can be transferred to each other using a polynomial time reduction,1 which indicates that if one of these problems can be solved in a certain time, all of the others can be solved in that time plus a polynomial time induced by the reduction. Unfortunately, the brute-force algorithm solution time increases exponentially with the size of the problem, and after many years of research, no improved algorithm has been found to solve these problems within a polynomial time using a deterministic Turing machine. In fact, many researchers believe that such an algorithm does not exist in principle. As a response to this failure of conventional computers, a number of physics approaches have been considered for NP problems.5 These approaches include the use of soap bubbles, protein folding, quantum6,7 and DNA8,9,10 computing. Optical computing also has been explored,11,12,13,14 including free-space white light interference,15 beam masking13,16,17,18 and time delay approaches.12,19 Unfortunately, not one of them reduces the complexity of the problem or offers technologically efficient solutions without exponentially increasing the demand on physical resources.

In this work, we provide experimental evidence that an NP-complete problem may be solved using an optical telecommunication fiber network as the information carrier. We demonstrate this approach using the directed Hamiltonian path problem of deciding whether a map can be traveled in a unidirectional manner such that each town is visited exactly once by exploiting our network as an ‘oracle’ for making a judgment on the existence of the Hamiltonian path rather than for finding the exact path itself. We argue that although our solution does not remove the fundamental mathematical complexity, it provides a robust and fast oracle that could be scaled to analyze maps of considerable size. Realization and demonstration of a fast-working solution for NP-complete problems within telecommunication networks may have a significant potential impact in applications such as secure communications, routing optimization and optical data processing.

The graph is implemented as a network consisting of optical fibers (roads) that connect all of the nodes (towns), and the network is probed using a short optical pulse. Visiting each town introduces a unique delay, and therefore, the existence of a directed Hamiltonian path can be asserted if a pulse is observed after a time delay equal to the sum of all of the towns’ delays. A proof-of-principle demonstration is performed on a fiber network representing a graph with five towns in which the decision is successfully obtained in only a few tens of nanoseconds. Although this result does not break the limitation of exponential solution time for NP-complete problems, our approach allows solution of this NP-complete problem at a rate that is hundreds of times faster than that of brute-force computing and may already find applications in routing and secure communications. In addition, to ease certain scaling issues typical of physical methods and to realize more complex cognitive photonic functions, the optical oracle can readily be implemented in integrated optical networks, such as silicon photonics or plasmonic networks.

Materials and methods

A target graph with five nodes (towns) connected by directional paths (roads) is chosen to determine whether there exists a directed Hamiltonian path, as shown in Figure 1a. Node 1 is set as both the starting and ending node. It can be observed that a Hamiltonian path of 1→2→5→3→4→1 exists. The concept underlying this approach is that an optical pulse is injected into the graph starting from node 1 to mimic the behavior of a ‘traveler’. The pulse ‘traveler’ simultaneously attempts all possible routes in the graph. For example, a pulse that reaches node 2 from node 1 will simultaneously try the path from node 2 to node 3 and the path from node 2 to node 5. The return pulses are monitored at node 1. These pulses represent all of the different routes in the graph that start from and end at node 1. These routes include three basic loops: (i) 1(inject)→2→3→4→1; (ii) 1(inject)→5→3→4→1; and (iii) 1(inject)→2→5→3→4→1, as well as the combinations of these basic loops, i.e., 1(inject)→2→3→4→1→2 →5→3→4→1. Thus, if pulses traveling along different routes can be separated, the pronouncement of the existence of the Hamiltonian path becomes trivial. The method we use assigns specific delays to each node, i.e., node j has a delay of Tj (j=1–5). The delay of each node is chosen such that its sum can only be obtained by summing each node’s delay exactly once. This approach indicates that for a pulse that visits all of the nodes exactly once, the delay that it experiences is unique, i.e., this pulse will not overlap with other pulses traveling along different routes in the pulse train returning to node 1. If such a pulse is observed from the returning pulses after a total delay of , then we can conclude that a Hamiltonian path exists; otherwise, the answer is negative.

Figure 1
figure 1

Optical network representation of the graph. (a) Illustration of the oracle approach to solution of the Hamiltonian path problem on a target graph with five nodes. An optical pulse is injected into the optical network and travels along all possible paths. A Hamiltonian path exists if a pulse returning to node 1 is observed after a delay equal to the total delay of the entire network. (b) Actual design of the graph with optical fiber components. The optical pulse is injected into the network via a 5050 fiber coupler. All of the couplers shown in nodes 2, 3 and 5 are 5050 fiber couplers. The pulses returning to node 1 are extracted using an 8020 fiber coupler, and 80% of their power is re-injected into the network. The delay of each node is realized by inserting a certain length of optical fiber. Two monitoring ports are included at nodes 3 and 5.

The actual realization of the graph is based on optical fiber and fiber couplers, as shown in Figure 1b. Details of the actual components and signal propagation are provided in Supplementary Information. For the specific graph used in this proof-of-concept demonstration, the delays of each node are set using different lengths of fibers, i.e., 18.8 ns for node 1, 14.8 ns for node 2, 15 ns for node 3, 5 ns for node 4 and 28.4 ns for node 5, such that the total delay  ns is unique. General strategies for the assignment of node delays in large graphs with arbitrary numbers of nodes and connections are discussed in the following section.

Results and discussion

The experimental set-up is shown in Figure 2. Light from an amplified spontaneous emission source at 1.55 µm is modulated by a Mach-Zehnder intensity modulator driven by an electrical pulse generator. After the modulator, the optical pulses have a pulse width of 8 ns, a repetition rate of 1 MHz and a pulse energy of 48 pJ. The pulses are injected into the target graph shown in Figure 1b. The pulses exiting the graph are detected by a photodetector and monitored by a real-time oscilloscope triggered by the synchronization signal from the pulse generator. Use of a low-coherence amplified spontaneous emission source guarantees that the pulses in the graph are incoherently combined in the fiber coupler (e.g., node 2 and node 5 combine their output pulses at node 3). Otherwise, coherent addition would lead to pulse energy fluctuation due to interference and fiber length fluctuation. The pulse train outputs from the graph are shown in Figure 3a–3c. The output from node 1 shown in Figure 3a is also the output of the entire graph. The time axis shows the delay with respect to the injected pulse. In Figure 3a, the first pulse is the pulse that travels along the path of 1(inject)→2→3→4→1, and its time delay with respect to the injected pulse is 53.6 ns. The second pulse with equal amplitude is the pulse that travels along the path of 1(inject)→5→3→4→1, and its time delay is 67.2 ns. The delay relative to the first pulse is 13.6 ns. The third pulse is the pulse that travels along the path of 1(inject)→2→5→3→4→1, and its time delay is 82 ns, which is equal to the sum of the total delays. The observation of this pulse proves the existence of a Hamiltonian path in the graph. This pulse visits an additional node compared with the paths of the first two pulses, and thus, its amplitude is half of that of the first two pulses. Certain pulses with smaller amplitudes also can be observed. These pulses propagate two cycles in the graph, and their time delays and amplitudes are summarized in Table 1.

Figure 2
figure 2

Experimental set-up for solving the Hamiltonian path problem with an optical oracle. Light from a low-coherence ASE source is fed into an optical intensity modulator driven by an electrical pulse generator. The pulse train after the modulator has a pulse energy of 48 pJ, a pulse width of 8 ns and a repetition rate of 1 MHz. The pulse train is injected into the target graph built from an optical fiber network. The pulses exiting the graph are monitored by a photodetector and an oscilloscope for detection of the pulse, thus indicating the existence of a Hamiltonian path. ASE, amplified spontaneous emission.

Figure 3
figure 3

Pulse train outputs from the graph. Outputs from (a) node 1, (b) node 3 and (c) node 5 of the graph and outputs from (d) node 1, (e) node 3 and (f) node 5 after the path from node 2 to node 5 is disconnected. The inset of (a) shows the pulse outputs from node 1 on a larger time scale. All of the time axes are referenced to the pulse injected into the graph. It can be observed that in (a)–(c), the third pulse has a delay of 82 ns, which is equal to the total delay of the graph. Therefore, this pulse indicates the existence of a Hamiltonian path. In comparison, in (d)–(f), because the path from node 2 to node 5 is disconnected, there is no Hamiltonian path, and the third pulse disappears accordingly. These results confirm that our approach is effective in indicating the existence of a Hamiltonian path.

Table 1 Summary of the time delays of the pulses output from node 1 in Figure 3a

The inset of Figure 3a shows the output from node 1 on a larger time scale. It can be seen that the amplitudes of the output pulses vanish within 200 ns and thus do not overlap with the pulse train generated by the following injected pulse. Figure 3b shows the output pulses from the monitoring port of node 3. Because the output pulses of node 3 propagate to node 1 via node 4, they are expected to be the same as the output pulses from node 1 (i.e., pulses in Figure 3a) except for different pulse amplitudes. For easy comparison with the pulses shown in Figure 3a, the time axis of Figure 3b is shifted such that the corresponding pulses can be shown in the same timing position, i.e., the first pulse in Figure 3b generates the first pulse in Figure 3a, the second pulse in Figure 3b generates the second pulse in Figure 3a, and so on. For the output of node 5 shown in Figure 3c (note that the time axis is shifted in a manner similar to that of Figure 3b), the first pulse is the one originating directly from node 1, and the second pulse is the one traveling from node 1 via node 2. All of the remaining small-amplitude pulses also can be identified in a similar manner, as summarized in Table 1.

To verify the validity of the proposed optical approach for determining the existence of a Hamiltonian path, we disconnected path 2→5 in the graph. In this condition, the third pulse corresponding to the Hamiltonian path 1(inject)→2→5→3→4→1 is expected to disappear from the output pulse trains in nodes 1, 3 and 5. This behavior is indeed confirmed by the outputs shown in Figure 3d–3f, which were recorded after breaking the connection from node 2 to node 5.

The key to the unambiguous oracle performance is the assignment of suitable delays for each node in the graph. If the number of nodes is small, as in our proof-of-concept demonstration, assignment of unique delays is straightforward. For the general case of a graph with N nodes and arbitrary connections among different nodes, node delays must be employed that satisfy the following relationship:

where Cj is a non-negative integer representing the number of times node j has been visited, and N is the number of nodes in the graph. In other words, the total delay introduced by the Hamiltonian path can only be obtained by summing the delay of each node in the graph exactly once. Such delay combinations exist. A theoretical proposal of delay assignment suitable for optical solution of the Hamiltonian path problem was advanced by Oltean:12

where Δt is the optical pulse duration. The corresponding solving time is Δt·N2N. Alternative assignments also can be found, e.g.,

where pj (j=1–N) is a prime number. Detailed proof of the validity of these two unique assignments is provided in Supplementary Information.

Similar to other ‘physical’ approaches, i.e., soap bubbles or DNA computing, the ability of the optical oracle to solve large NP problems is limited by scaling of the physical resources required, including the overall length of the optical fibers needed to encode the network and the light intensity required to overcome absorption losses or pulse width broadening due to dispersion. For example, if a 30-node graph is constructed as an optical oracle fiber network using the delay assignments in Equation (2) and is interrogated with 1-ps optical pulses, its implementation would require a minimum fiber length of approximately 100 km and a maximum fiber length of approximately 200 km. Although such lengths may require in-fiber optical signal amplification to compensate for the losses, this approach is widely used in telecom networks and is within reach of current fiber technology. Dispersion-induced pulse broadening also can be overcome by choosing a center wavelength for the probe pulse that is close to the zero dispersion point of the fiber and using dispersion compensation elements.

The optical oracle relies on short pulses that propagate with the speed of light and the massive parallelism of fiber networks resulting from multiple branching of the pulses. This structure enables a fast and reliable pronouncement on the existence of a Hamiltonian path. For comparison, a brute-force search on a conventional computer would require up to N! attempts. Even with smart algorithms such as dynamic programming, the conventional computers would require approximately 1/8·N22N operations (additions and comparisons).20,21 For computers with a clock period τ, this process will require at least τ·1/8·N22N s to perform, which indicates that our approach is /8Δt times faster than dynamic programming algorithms. With a pulse duration of 1 ps, a graph with 30 nodes could be solved approximately 375 times faster than with a 10-GHz clock rate computer. We note that the optical oracle loses to probabilistic Monte Carlo algorithms21 that can solve the Hamiltonian path problem with a certain degree of uncertainty in time O(1.657N). However, our approach completely excludes false predictions.

Practical applications of the Hamiltonian path oracle could include secure communications in which a scrambled binary signal sequence (or key) is encoded as a sequence of graphs, each of which represents either ‘1’ or ‘0’ bits in the binary signal depending on whether they support the Hamiltonian path. For a graph of 30 nodes, the Hamiltonian path oracle pronouncement with dynamic programming algorithms would require approximately 12 s on a 10-GHz clock rate electronic computer, whereas the optical oracle could accomplish this task in a brisk 32 ms. Although the network will be multifarious, it could be easily reconfigured using optomechanical switches, thus allowing the interrogation of hundreds of networks within a second. Therefore, on a reconfigurable oracle, the scrambled sequence (or key) may be unscrambled in a time proportional to the number of bits in the sequence and the time needed to reconfigure the network and verify the existence of the Hamiltonian path (ms), whereas if performed by brute-force computing, it may require a prohibitive amount of time.

Conclusions

In conclusion, we have provided an experimental demonstration of how a fiber network can be used to solve a well-known NP-complete problem. Although we do not suggest that existing global or local optical fiber networks can realistically be deployed for computing applications, we argue that in the future, highly reconfigurable optical fiber networks should not be overlooked as a powerful computing and decision-making hardware platform. Moreover, our strategy also can be implemented on a silicon photonics platform, and in principle, could be deployed on plasmonic waveguide networks with femtosecond lasers by exploiting the slow dispersion of plasmon polariton pulses.22 This approach would allow for compact, highly integrated solutions and the development of multiple network parallel architectures similar to the multicore structure of conventional processors.

Author contributions

JGA, NIZ, CS and KW generated the original idea and designed the experiment, and KW built the oracle and gathered experimental data. The manuscript was written by KW, NIZ and CS, and PPS contributed to the interpretation and analysis of the results and editing of the manuscript. All of the authors contributed to the discussion of results. NIZ supervised the work.