Abstract
In this paper we describe a heuristic procedure for solving the travelling salesman problem in the symmetric case without using the triangle inequality c
ij
≤ c
ik
+ c
kj
. A complete proof of the correctness of the algorithm and example of the presentation how the method works are given. There is estimated computational complexity, which is at most O(m2), where m is a number of the edges of the complete graph with n vertices -K
n
. There is shown also, it is possible obtain the following bound that
Keywords
Introduction
The symmetric travelling salesman problem (abbr. STSP) may be formulated as the problem of finding minimum cost tour in undirected simple graph G (V, E) i.e. graph that does not have any loops or parallel edges. We have to solve the following formula:
In additional, we assume that the triangle inequality is not satisfied i.e. C ij ≤ C ik + C kj .
If the conditions (1) and (2) are satisfied, condition (5) is omitted and condition (3) is replaced by the inequality below
These two problems differ from each other in respect of the computational complexity. The first problem is NP-complete, but the second one belongs to P-class and it may be easily solved by the Hungarian method [2, 3]. Basirzadeh in his paper [6] slightly modified the assignment method to get a tour of the travelling salesman problem.
Our approach to solve STSP relies on some ploy. This involves creating and manipulating simple disjoint cycles.
For the sake of clarity we will introduce some denotations. We denote by:
a graph with ordered pair comprising a set V of vertices together with a set E of edges,
a complete graph with n vertices,
a set of vertices of the graph G,
a set of edges of the graph G,
an edge of the graph G (V, E) that is incident to vertices {i, j } ⊂ V,
the degree of vertex v,
a cost c ij , function w : E → R+,
a Hamiltonian circuit,
an optimal Hamiltonian circuit,
the solution of the STSP,
cost(weight) of any edge ek that belongs to simple circuit C S ∈ { C A },
cost(weight) of any edge ek that belongs to an optimal Hamiltonian circuit
a Hamiltonian circuit that is constructed by heuristic procedure,
a set of the simple disjoint circuits that are covering all vertices of the complete graph K n , where simple circuit denotes a circuit that does not have any other repeated vertices except the first and last. Simultaneously it is an admissible solution of the assignment problem too. If | { C A } | = 1 we have a Hamiltonian circuit C A ≡ C H ,
the weight of {C A },
i-th iteration (step 2 in the described algorithm) of the list L of ordered edges according to the increasing weights,
graph created from the edges of list L i and their incident vertices,
an ordered set A,
an unordered set A.
Let’s consider the graph G (V, E) of the symmetric travelling salesman problem. If any edge e (i, j) ∉ E, then we construct the complete graph K n (V, E, ⊃ E), where e (i, j) ∈ E’ on condition that c ij =∞.
The following algorithm given below describes the heuristic procedure to solve STSP.
Algorithm
We order the edges of the complete graph K
n
according to the rise of their weights w (e1) ≤ w (e2) … ≤ w (e
j
) … ≤ w (e
m
) by some variant form of the listing algorithms, where We start (i + 1) iteration by creating ordered list Li+1 =< L
i
∪ { e1 } > of the new set of edges. We check if edges of set L
i
constitute a Hamiltonian circuit. If yes, then we have an approximation solution We consider graph We define an edge with maximum weight emax among the elements of set L
i
, that are defined by two vertices {v
i
, v
j
} ∈ V ∖ T subject to deg(v
i
) ≥ 2 and deg(v
j
) ≥ 2, where symbol “∖” denotes the difference of any two sets. In the case where there are several edges that satisfy these conditions, we select them arbitrarily and do the following operation E (L
i
) : = E (L
i
) ∖ emax. If there is only one such edge, we choose it. We update set T. From the ordered set of edges of the complete graph K
n
(step 1). We select the first edge el (n + 1 ≤ l ≤ m) that connects two vertices that belong to set T. We update graph We link, in arbitrary order, k simple, disjoint circuits and we construct a Hamiltonian circuit in some way as it’s shown in the Fig. 1. We identify two vertices i* ∈ V (C1), j* ∈ V (C2) where C1 and C2 are simple disjoint circuits, V (C1) and V (C2) are two sets of the vertices that satisfy the condition (*)

A Hamiltonian circuit.
where i = 1, 2, …, |V (C1) | and j = 1, 2, …, |V (C2) |
If a few pairs of edges satisfy this condition, we select a pair of the edges arbitrarily.
After that, we remove edge e (i * , j * +1) ∈ E (C1) and edge e (i * , j * +1) ∈ E (C2) and next we add the following two edges: e (i * , j *), e (i * +1, j * +1) – see Fig. 1. We go to step 3.
By this way we construct a Hamiltonian circuit
To present how this algorithm “works”, let us consider a complete weighted graph K6 as an example (Fig. 2).

Graph K6.
In our example K6 we have |V| = n = 6, |E| = 15 and | { CH } | = (n - 1) !/2 = 60. The 15 edges have the following weights assigned to them:
w[e(F,A)] = 1
w[e(F,B)] = 5
w[e(F,C)] = 5
w[e(F,D)] = 12
w[e(F,E)] = 14
w[e(A,B)] = 9
w[e(A,C)] = 12
w[e(A,D)] = 12
w[e(A, E)] = 11
w[e(B,E)] = 6
w[e(B,D)] = 7
w[e(B,C)] = 13
w[e(C,D)] = 2
w[e(C,E)] = 3
w[e(D,E)] = 2
According to step 1 we obtain an ordered set <L1>:
<L1> = < w [e (F, A)] = 1 < w [e (C, D)] = w [e (D, E)] = 2 < w [e (C, E)] = 3 < w [e (F, B)] = w [e (F, C)] = 5 < w [e (B, E)] = 6 < w [e (B, D)] = 7 < w [e (A, B)] = 9 < w [e (A, E)] = 11 < w [e (F, D)] = w [e (A, C)] = w [e (A, D)] = 12 < w [e (B, c)] = 13 < w [e (F, E)] =
The six first edges in this ordered set are marked in the sequence above by bold font. Because condition in step 3 is not satisfied we go to step 4 and define set T ={ A, B }.
In the next step we identify and remove from set E (L1) edge emax = e (F, C) = 5, set T is not changed. In step 6 we define edge e1 = e (A, B) and update graph
It is easy see that the edges from the set {e (F, A), e (A, B), e (F, B), e (E, C), e (C, D), e (D, E)} can create 2 cycles C1 = {F, A, B, F} and C2 = {E, C, D, C}. We observe that these two cycles cover all vertices of the graph K6. We go to step 7. In this step we link two cycles C1 and C2 under condition (*) from the algorithm. We notice that:
min {w [e (A, E)] + w [e (B, D)], w [e (A, D)] + w [e (F, E)], w [e (A, C)] + w [e (B, D)], w [e (B, C)] + w [e (A, D)], w [e (B, E)] + w [e (F, D)], w [e (F, D)] + w [e (A, C)], w [e (F, C)] + w [e (B, D)]} = w [e (F, C)] + w [e (B, D)] = 7 + 5 =
As we see, we add 2 edges: e(F,C), e(B,D), which connect cycle C1=F, A, B, F and cycle C2=E, C, D, C and we remove 2 edges: e(F,B) and e(D,C).
As a consequence we obtain a Hamiltonian circuit
We can observe that there is little difference between our approximation solution and optimum.
Now we will prove the correctness of the algorithm.
In any graph K
n
, n selected edges cause that each vertex v ∈ V (K
n
) is incident to some edge e ∈ E (K
n
) and there are two vertices v1 and v2 which satisfy deg(v
i
) ≥ 2, i = 1, 2. There are no isolated vertices. Steps 5, 6 always define two edges emax and el – these rules decide about finiteness of our algorithm. It’s obviously that |L
i
| = n for each iteration i. Furthermore, if for each vertex v ∈ V (K
n
) deg(v) = 2 and condition in step 3 is satisfied, we obtain a Hamiltonian circuit or in other case we have set {C
A
}. Step 6 decreases the cardinality of set T at least by one. For any graph G (V, E), if for each vertex v we have deg(v) ≥ 2, then |E| ≥ n. For any graph G (V, E) we have ∑v∈V deg(v) = 2|E| – elementary fact from the graph theory. It is obvious that step 7 of the algorithm decreases the number of simple circuits at least by one.
We conclude that: it is an obvious fact, follows from (2), it is an obvious implication, follows from the property of construction of step 6 in the algorithm, follows from (7), because of the fact that in the borderline case of graph
Fact (2) follows because of the following: emax is always defined – we conclude this from fact (1) and step 5, if in some iteration i the edge el cannot be defined, then we have n –1 edges, |T| = 1 and ∀v∈V∖T deg(v) ≥ 2. Then from one side we have
This is borderline case with n - 2 vertices, where have deg(v) = 2 and 2 vertices with deg(v) = 3. From other side we have (n - 1) + 1 = n edges because of one vertex belonging to T (step 4 of the algorithm). We obtained a contradiction.
Based on (3-6) and (8) we conclude thesis of our theorem (q.e.d).
Let’s consider the problem of computational complexity of the algorithm. In our case we assume the parameter m as a characteristic of the dimension in our problem, where m is the number of edges in a complete graph K
n
. Considering the seven consecutive steps, we conclude that: step 1 costs at most O(m*log(m)) elementary operations, step 2 costs at most O(m) elementary operations, step 3 costs at most O(m) elementary operations, step 4 costs at most O(m) elementary operations, step 5 costs at most O(m) elementary operations, step 6 costs at most O(m) elementary operations, step 7 costs at most O(m2) elementary operations.
Hence we obtain the following theorem.
the properties of the given algorithm, if the algorithm works on the data of size m (m – natural number) at the time c*m2 for arbitrary constant c, then we say that the computational complexity is O (m2) [11]. In our case c = 7 (seven steps of the algorithm).
An estimation of the bound
We are interesting in the estimation of the bound for our heuristics. We can show that if the following inequality
Two edges incident to this vertex belong to some cycle CA, but not to Only one edge Both edges
We are interested in the first two cases. Assume that inequality (**) is satisfied for these two cases. Let s be such a number of the edges
Surely, if we have under taking the inequality
It is clear that for any two edges
In inequality (8) “mini” denotes some constant.
Using (7), (8) and the properties of the algorithm, we obtain:
Dividing both sides of inequality (3) by
because of {q1, q2 } ∈ (0, 1). This ends proof of the theorem (q.e.d.).
In this paper we analyzed symmetric classical travelling salesman problem (STSP) without using triangle inequality. We presented some heuristics, where under some condition the ratio
In [4] Christofides showed heuristics that require O (n3) computations for matrices satisfying the triangle inequality. Some modifications of this heuristics are contained in paper [5], with polynomial complexity.
Sahni and Gonzales in their article [1] proved, that if the triangle inequality does not hold then, for constant c ≥ 1 the problem of finding an approximate tour
The survey of the latest results of experimental calculations can be found in paper [10]. This survey is limited to selected approaches, because it is not possible to cover all off them. The authors of this paper discussed only the most relevant approaches such as: Brute Force Method, Greedy Approach, Nearest Neighbour Heuristic, Branch and Bound Method, 2-opt Algorithm, Greedy 2-opt Algorithm, Genetic Algorithm, Neural Network, Simulated Annealing.
The efficiency of these heuristics are given as a relation between number of cities and time in sec to find heuristic a solution. In some papers in the literature the efficiency of the discussed heuristics is given in the form of the graphs of a function as the relation between two parameters - time and cities. There are of course possible combinations of well known algorithms, for example a combination of the Nearest Neighbour and Minimum Spanning Tree algorithms [9].
Our result is rather theoretical nature, without experimental calculations. In some way our algorithm presented in this paper can be treated as a compilation of the Nearest Neighbour Heuristic and Greedy Approach. A reader interested in the history of the TSP and some implementations can find specific information in paper [7] and [8].
