A hamiltonian sequence is a path walk P that can be a hamiltonian path or hamiltonian circuit. Determining whether such sequence exists in a given graph is a NP-Complete problem .
Several algorithms have been proposed to find hamiltonian sequences in a graph . For example, Held and Karp proposed an algorithm that runs in to compute a hamiltonian path . Bjorklund, on the other hand, proposed an algorithm that runs in to compute a hamiltonian circuit . Unfortunately, exact algorithms proposed to solve the hamiltonian sequence problem, which is determining if hamiltonian path or hamiltonian circuit exists in a graph , still runs in exponential time complexity.
In this paper, a novel algorithm is proposed to solve the hamiltonian sequence problem in a different way. The goal here is to construct a potential hamiltonian sequence , assuming that can have potential forbidden minors that prevent a potential hamiltonian sequence from being a hamiltonian sequence. Thus, these potential forbidden minors need to be degenerated in some state
in a two-phrase process by using a goal-oriented approach. The algorithm outputs a valid hamiltonian sequence or abort the process, if it is forced to use probability instead of the proposed goal-oriented approach.
The section 2 of this paper lists some definitions and provides a solid foundation for the proposed algorithm. In the section 3, the details of the algorithm are presented.
In this section, some concepts about graph theory are described. Also, this section provides a concise background needed for a better understanding of the paper. A graph consists of a set V of vertices and a set E of edges. The vertex set of a graph G is refereed to as V(G), its edge set as E(G). The number of elements of any set is written as . Each edge is undirected and joins two vertices , denoted by . To represent adjacency between two vertices we use the notation . The set of neighbors of a vertex is denoted by . is a subgraph of G induced by that contains all the edges with . is a subgraph obtained from G by deleting all the vertices and their incident edges. If and , we write rather than . is the number of components of a graph . If is an articulation point then we will have . A minor of a graph G is any subgraph obtainable from G by means of a sequence of vertex and edge deletions and edge contractions . A class or a family F of graphs G contain all graphs G that posses some common characterization. Many families of graphs are minor-closed, that is, for every G in F every minor G’ of G also belongs to F. According to Robert-Seymour , every minor-closed families has a finite set X of excluded minors. For example, a major step towards deciding whether a given graph is planar is provided by Kuratowski’s theorem which states that if G in P where P is the family of planar graphs, then G contains no minor belongs to . 
Many methods were studied to test the planarity of a graph G. One interesting method to determine if a graph G is planar was proposed by Schmidt  that incrementally build planar embeddings of every 3-connected component of G. Schmidt studied a far-reaching generalization of canonical orderings to non-planar graphs of Lee Mondshein’s PhD thesis  and proposed an algorithm that computes the called Mondshein sequence in . Mondshein sequence generalizes canonical orderings and became later and independently known under the name non-separating ear decomposition .
An ear decomposition of a 2-connected graph is a decomposition such that is a cycle and is a path with only two endpoints in common with . Each is called an ear. 
Mondshein proposed to order the vertices of a graph in a sequence that, for any , the vertices from 1 to induce essencially a 2-connected graph while the remaining vertices from + 1 to induce a connected graph. For conciseness, we will stick with following short ear-based definition of mondshein sequence. 
Let G be a graph with edge . Assuming that is part of the outer face of G. A Mondshein sequence avoiding ru is an ear decomposition of such that (1) , (2) is the last long ear, contains u as its only inner vertex and doesn’t contain and (3) D is non-separating. 
An ear decomposition D that satisfies the conditions (1) (2) and (3) is said to avoid , so is forced to be added last in D, right after the ear containing u as an inner vertex.  These constraints negated form the forbidden condition of the Schmidt’s algorithm since such algorithm can’t ignore them. Otherwise, the Schmidt’s algorithm fails to produce a valid output.
A forbidden condition of a non-exhaustive algorithm is a sufficient condition to make such algorithm fail to produce a valid output.
Before continuing, let Validator be a generic hamiltonian sequence validator function that outputs true if with is a hamiltonian sequence of G performing subsequent operations.
Here, conditions like or being an articulation point make Validator have false as output. Unfortunately, such invalid conditions are useful only to test if is a hamiltonian sequence or not. There’s some sufficient conditions available for a graph to posses a hamiltonian sequence  but there’s no known non-exhaustive algorithm for hamiltonian sequence characterization test that constructs a valid hamitonian sequence by performing subsequent operations and throwing an error, if doesn’t have any hamiltonian sequence. Likewise, there’s no known forbidden condition for the hamiltonian sequence problem. At the same time, find a hamiltonian sequence by relying on exhaustive methods is not feasible. The lack of a known forbidden condition for hamiltonian sequence characterization test motivated this research.
In this paper, a novel algorithm called syncronization-based forbidden condition mirroring for hamiltonian sequence problem is proposed.
Let be a graph. The Synchronization-based Forbidden Condition Mirroring (SFCM) algorithm is an algorithm with a configuration (F, W) that consists of a set of synchronizable forbidden conditions and a set of scenes such that and .
Before continuing, a trivial example of how the proposed algorithm works in practice is presented for a better understanding of the paper. Let’s convert the Schmidt’s algorithm to a SFCM algorithm. Let be a scene that Schmidt’s algorithm takes as input and be a scene called Schmidt Scene that SFCM algorithm takes as input. The description of Schmidt Scene is as follows.
Each is an component and the edge is a forbidden ru-component that needs to be degenerated in some state .
Notice that ru-component is a potential forbidden minor of Schmidt Scene that needs to be added last by SFCM algorithm in order to not make the such algorithm fails to produce a valid output. As the edge can be also considered a potential forbidden minor of Schmidt’s algorithm, all we need to do is to make the SFCM algorithm imitate the behaviour of Schmidt’s algorithm so that the forbidden conditions of both algorithms will be completely synchronized. As the only difference between the SFCM algorithm and Schmidt’s algorithm is that they’re conceptually different, they’re also completely mirrored.
The forbidden conditions of a scene and are synchronized when they have the same behaviour.
In this paper, we use a variation of the same approach to construct a hamiltonian sequence path P. In this case, is the scene that an unknown non-exhaustive hamiltonian sequence characterization test takes as input and is the scene called minimal scene that the proposed SFCM algorithm for hamiltonian sequence problem takes as input. We assume that every state of the proposed SFCM algorithm have potential forbidden minors that make such algorithm fail to produce a valid hamilton sequence. In addition, we also assume that, if has a hamiltonian sequence, these potential forbidden minors will be degenerated in some state of iterations made by the proposed algorithm.
The goal here is to synchronize the forbidden condition of the proposed SFCM algorithm and an unknown non-exhaustive hamiltonian sequence characterization test by an imitation process. The minimal scene description is based on invalid conditions that make Validator have false as output on minimal state. In other words, such invalid conditions belongs only to a minimal scene, not to real scene or simply , which is the scene of an unknown non-exhaustive hamiltonian sequence characterization test algorithm we want to mirror. Such unknown algorithm will be called real scene algorithm.
3 Proposed algorithm
In this section, the SFCM algorithm for the hamiltonian sequence problem is explained in detail. We call such algorithm SFCM-R. Before continuing, we need to define formally the minimal scene and some important functions. The minimal scene is formally defined as follows.
Let be a graph. A minimal scene of G is a rooted graph with a set of labels associated with each vertex , a root vertex and a set of tiers .
Let be a minimal scene of G and . By convention, is the current state’s vertex and , its successor. is performed whenever a vertex u is defined as a valid choice. It will be written as . is a path from to . As we need to find a vertex such that holds for , the algorithm analyses a subgraph that will be denoted as tiers. A set of tiers is defined by the function called maximum-induction described bellow.
Now we’ve setup all tiers by maximum-induction, we need to identify all the stumbling blocks that will probably break our hamiltonian sequence on each tier and degenerate them. These points are denoted as hamiltonian breakpoints or since the algorithm assumes that they’re potential forbidden minors of a potential hamiltonian sequence of . When maximum-induction outputs a valid set , the next step is to get the vertices labelled according to the function Lv-label that outputs a set which is the set of labels associated with each vertex . By convention, is a vertex labelled as and represents the vertices labelled as . is the root of and is the of its current state. The notation represents a set of all vertices labelled as . Before continuing, we’ll briefly describe what each label means. Let be a vertex . If w is an articulation point of , it will labelled as or virtual articulation. If and it will labelled as virtual leaf or . Every non-labelled will be labelled as degeneration vertex or . Every vertex that is not a and have is an intersection vertex or . Any other non-labelled vertex will be labelled as . Vertices labelled as and are vertices. Vertices labelled as are not considered as vertices.
Now, a concise description of minimal scene is finally provided below.
Here, every vertex is a real articulation point and every vertex is a potential real articulation point. In addition, every vertex is part of an isolated component such that . Thus, if we have then we will have -components. vertices are considered as intersection points between components. , and vertices aren’t part of any component. The function defined bellow returns if is a virtual articulation point of or F, otherwise. is a virtual articulation only if .
The term virtual indicates that some definition belongs only to minimal scene, not to real scene. Thus, we’ll define an additional function that returns true if .
The vertex is a non-virtual articulation point of . Every non-virtual articulation points of are labelled as and represents a component. In order to keep a valid state, every needs to be mapped and degenerated in some state of iterations performed by either first or second phrase. If can be degenerated in a state , then is called b-treatable. Here, we need to assume that , exists a state which will be b-tratable.
Let be a vertex with . Let and be vertices of . A b-tratable or is a vertex reachable from through a path with such that we have when we recalculate its label in subscene
If can be degenerated, cant’ be considered a b-consistent anymore.
A b-consistent or is a consistent that can’t be degenerated in current state.
As we don’t know a detailed description about the forbidden condition we want to mirror, we will stick with a conceptually different definition of hamiltonian sequence problem that relates real scene to minimal scene explicitly. The path problem is as follows.
( path problem) Given a scene , is there a simple path that visits all vertices with such that with ?
As the path problem is similar to the hamiltonian sequence problem, it must be NP-complete. In the minimal scene, if we have a path that degenerates in , such will be part of another fragment. In first phrase of the proposed algorithm, we pass through with the aim of degenerating components in order to create a potential hamiltonian sequence .
It means that the following theorem, which is a sufficient condition to make Validator output false, will be partially ignored in first phrase or simply mapping phrase, which is represented by Mapping function.
Let be a graph. If with , is hamiltonian sequence of , then holds for only and only if .
If we have , at least one component is not reachable from . Therefore, holds for , which is not a hamiltonian sequence since at least one vertex is not reachable from . ∎
Because of that, both first and second phrase of the proposed algorithm need to enforce basic constraints related to real scene in order to not ignore theorem 1 completely. Before continuing, we will adopt some additional conventions. The parameter of a subscene indicates that was generated by and has vertices adjacent to different non-virtual articulation points of . The two basic constraints are as follows.
can’t have a component with and .
If is reached by either or , will hold for when this happens. Such situation is invalid since it makes the algorithm ignore theorem 1 completely. The SFCM-R algorithm assumes that every is reachable from either or without ignoring theorem 1 completely. ∎
can’t have a component and .
In this case, we have two or more disconnected components. Thus, there exists at least one not reachable from neither nor by . Such situation is invalid since it makes the algorithm ignore theorem 1 completely. The SFCM-R algorithm assumes that every is reachable from either or without ignoring theorem 1 completely. ∎
In addition, the complexity of the algorithm proposed can’t be exponential. Otherwise, we’re implicitly trying to solve this problem by using exhaustive search methods. Such situation is clearly invalid since the SFCM-R algorithm must try to imitate the behaviour of real scene algorithm. That’s why every choice must be goal-oriented in both two phrases of SFCM-R algorithm. In other words, both phrases must be goal-oriented. Throughout this paper, a proof that both phrases are imitating the behaviour of real scene algorithm shall be presented with an appropriate background.
Goal-oriented choice is a non-probabilistic choice that involves minimal scene directly and real scene partially. Such choice is represented by both constraints and goal-oriented strategies.
As the algorithm pass through instead of , we’re considering minimal scene directly. In addition, the real scene is considered partially since some basic constraints related to real scene algorithm are evaluated by the proposed algorithm. Throughout this paper, constraints followed by an intuitive description shall be presented in this order by convention. All the goal-oriented strategies developed through this research shall be presented along with an appropriate background.
Notice that the real scene generate only consistent components in order to generate a valid hamiltonian sequence optimally. Therefore, the real scene algorithm can be idealized as follows.
In addition, notice that the idealized version of real scene algorithm doesn’t have any explicitly relationship with the proposed minimal scene and thus, it need to be modified to properly represent a mirrorable real scene algorithm, which is the real scene algorithm we want to mirror. Such modification shall be presented with an appropriate background.
A mirrorable algorithm is a non-exhaustive algorithm that takes a scene , with a forbidden condition conceptually different from every scene , as input.
Therefore, the main goal of the proposed algorithm is to imitate the behaviour of real scene algorithm in order to avoid using probability, which is a known behaviour of a generic exhaustive algorithm. That’s why the second phrase or simply reconstruction phrase, which is represented by the function Reconstruct, abort the process if it’s forced to use probability while reconstructing . Such reconstruction process is explained throughout this paper.
3.1 Mapping phrase
In this section, the mapping phrase is explained. This phrase outputs a non-synchronized hamiltonian sequence or simply set. Such set is used by reconstruction phrase, which tries to reconstruct a hamiltonian sequence by modifying in order to output a valid hamiltonian sequence (if one exists). The mapping task is done by the Mapping function. This function takes scene and scene as input by reference along with additional parameters (, , , , , , , ) by reference and keep calling itself recursively until reaching its base case.
A non-synchronized hamiltonian sequence is a sequence of path fragments.
By convention, the notation will be non-synchronized edges created by Mapping. can be any non-synchronized edges with . The mapping task performed by Mapping has the following structure:
(1) or (2) forms the base case of recursion. If base case is reached by first condition, then we assume that every must be in some state at first.
The current state of .
In current state, some constraint must make hold for at least one . If we don’t have any with , we have to undo one step and try an alternative choice in current scene until with being the local error counter of Mapping and being the local error counter limit of Mapping. The Sync-Error procedure is called by Mapping whenever it finds an inconsistency. Such procedure increments both and by reference with being a global error counter of Mapping. If , the current subscene must be discarded by Mapping and the current state is changed to another in an earlier valid subscene. On the other hand, if with being the global error counter limit of Mapping, the mapping process must be aborted.
This phrase may require attempts with a different vertex set as in order to output a valid . If this process outputs a valid set, the algorithm assumes at first that every must be in some state of the proposed algorithm. In other words, the algorithm assumes that both Mapping and real scene algorithm have pre-synchronized forbidden conditions.
Every constraint must be checked into . In order to check if some constraint holds for , Mapping must update the labelling of by calling Lv-label function only. Some constraints have nested constraint that induces by a set . These nested constraints need to be checked into by calling Lv-label function only. The only case that requires the current subscene to be completely changed is when . In this case, we have a context change because must be reachable by or without ignoring theorem 1 completely. Because of that, an additional subscene such that , and need to be created by Mapping since the minimal scene is not aware of the existence of non-virtual articulation points. After is processed by Mapping, the current labelling of becomes obsolete. Because of that, it needs to be changed. As can be different from in or after is processed, we need to create an edge whenever we need to make a context change, which is done by the function Context-change, in order to make and work correctly. That’s because such will act like a vertex that was chosen by in a imaginary state with .
The constraints considered in this phrase are defined as follows.
, if and
As is considered an isolated component by minimal scene, it can’t influence the labelling of any directly. ∎
, if we have at least one for with being a -path generated by with , such that and
In this case, is part of a degeneration process. ∎
, if we have at least one for with being a -path generated by with , such that and
A is a leaf on its minimal state that can act like a such that that degenerates a such that . In this case, is behaving like a leaf of real scene algorithm such that instead of a vertex since it’s part of a degeneration process. As can’t be labelled as , can’t disconnect the minimal scene since such is inconsistent. In addition, notice that can potentially create inconsistencies in real scene. That’s why is considered a potential real articulation of minimal scene.
, if and .
In this case, doesn’t influence the labelling of any vertex directly since and . ∎
, if and .
If and we assume that can be the next choice. ∎
, if and in or .
In this case, we will have .Thus, such is inconsistent since we will have . ∎
If and , then . In such state, the algorithm tries to make behave like leafs of real scene such that . If so, is degenerated since such can’t be considered a potential articulation point anymore.
If there’s no other valid choice for , we have , , and .
Vertices labelled as , and aren’t part of any directly. In addition, notice that vertices such that are always part of a -path starting from such that . Therefore, can’t be degenerated as directly. That’s why can’t be considered a component. ∎
The goal of Mapping phrase is to output a valid set ready to be reconstructed in next phrase. The key to construct a valid is take into account the priority order of each choice. The priority order plays an important role in this phrase since it will make the mapping phrase imitate the behaviour of the real scene algorithm. As a consequence, if this phrase generates an inconsistent that prevents from being a hamiltonian sequence, the SFCM-R algorithm will be able to degenerate such inconsistency and generate another to change parts of until we have a valid hamiltonian sequence (if one exists) by correcting parts of such imitation process. This process will be called attaching or minimal scene attachment because inconsistent components will be degenerated by considering minimal scene directly and real scene partially. Such process is done in reconstruction phrase by using a goal-oriented approach.
A attaching is when we choose a vertex with before makes inconsistent. A is attached when (1) holds for or (2) a -path that doesn’t generate any inconsistency in is generated by .
A -path is a path generated by such that and in which every reach successfully.
The priority order relies on the label of . If the priority is times higher than an arbitrary constant , it will be denoted as . The highest priority is to make a be . So we will have and . has the higuest priority because it can potentially increase since it’s considered a potential real articulation point of minimal scene. If Mapping can’t make any be in current state, we want to change our context instead of undoing states. Thus, we will have since these vertices can generate articulations with high probability. In addition, we have since we can have some valid in next current state. The lowest priority is for since its not part of any . So we have for vertices labelled as .
Notice that we don’t have any constraint that makes hold for since it can disconnect the minimal scene according to its description. Even so, we will have in some state of the algorithm if Reconstruct outputs a valid hamiltonian sequence. It means that the constraints related to vertices labelled as can’t be evaluated directly in this phrase.
Firstly, a Context-change( , ,) call is needed to calculate and of initial such that , , before the first Mapping call. When Mapping is called, if , Mapping must create a subscene with after is removed from (line 7). must have in H, and . Before set such component, Mapping needs to perform (1) and (2) , with LAST being a parameter used to store an earlier v state, in order to configure properly in line 7. Such parameter is used to make the algorithm keep track of earlier states with .
Its important to mention that Mapping needs to call Context-change function before Mapping call itself recursively if was set (lines 10 and 17). Every vertex deleted from by a operation made by Select function (line 30 and 46) must be also deleted from before its context change (line 12). Such rule doesn’t apply for vertices removed from when (lines 20 and 44) since such can be part of another components in different recursive calls. If , the split flag is set to false (line 14). In this case, was not explicitly reached by any operation made by Select. As we’re ignoring theorem 1 partially, we need to force to be changed in next recursion call in order to make Mapping create a new since a new can turn to be explicitly reached by a operation made by Select in .
If , we need to follow the constraints and priorities mentioned earlier (line 29). In this case, If holds for at least one , we must (1) perform , (2) add an edge to and (3) perform . Mapping needs to call Select in order to do such operations by reference when the context remains unchanged (lines 30 and 46). If holds for every , we need to undo the last step and try an alternative, incrementing and by calling Sync-Error. Every error found in mapping phrase must increment and . If , the current subscene must be discarded by Mapping, that needs to perform undo operations to choose another in an earlier valid subscene. On the other hand, if , the process must be aborted. In this phrase, none of vertices can have more than two incident edges since must be a sequence of path fragments. Therefore, If , Select must remove the first added to by reference.
In addition, Mapping must never remove the current from except in two cases. The first case that can be removed from is before a context change that changes such (line 17). The second case is when and (lines 20 and 44). Also, Mapping can’t have with unless , , and . Such restriction imitates the way that real scene algorithm reaches from .
3.1.3 Proof of correctness
This section is dedicated to the proof of correctness of mapping phrase. It’s important to mention that SFCM-R algorithm can only use goal-oriented choices. Because of that, we need to prove that Mapping is goal-oriented. Consider the following lemmas.
Let be a scene. holds for every with and .
Let H be a scene such that is a hamiltonian graph, and . For every with , we have , which is the upper bound of . Let’s add a vertex and an edge to , set as and call Context-Change( , ,). As holds for first tier , is the upper bound. Thus, holds for when . Now suppose that . In this case, holds for since in holds for every . Let’s connect with every vertex except and call Context-Change( , ,) again. In this case, will hold for when we have since in holds for every . Therefore, holds for every with and . ∎
Let be a scene. such that abort the mapping task process only if at least one valid for every found is known.
If at least one valid for every found is known in mapping task, will force Mapping to abort the process when there’s only invalid vertices for when . If , such that