A MULTI LABEL ALGORITHM FOR k SHORTEST PATHS PROBLEM A MULTI LABEL ALGORITHM FOR k SHORTEST PATHS PROBLEM

Many problems related to transportation or communication lead to the problem to find in a network relatively short point to point path which has to fulfill certain special constraints that cannot be simply formulated by means of graph theory. Such problems can be solved by successive enumeration of k shortest paths and consequently by choosing that one from them which complies with given constraints.


Introduction
Many problems related to transportation or communication lead to the problem to find in a network relatively short point to point path which has to fulfill certain special constraints that cannot be simply formulated by means of graph theory. Such problems can be solved by successive enumeration of k shortest paths and consequently by choosing that one from them which complies with given constraints. This work was motivated by the problem of finding a bus and train connection using digitalized bus time table and train time table. The user requires not only one but several proposals of such connections and he chooses among them that one which fulfills his special personal requirements. The connection searching problem can be formulated as a shortest path problem in a huge acyclic digraph G having a vertex for every pair (stop, minute) where stop is a bus stop or railway station and minute ʦ {0, 1, …, 1439} is a minute of the day. The arc set of digraph G is the set of all ordered pairs ((deperature_stop, deperature_time), (arrival_stop, arrival_time)).
Such a digraph G for the Slovak Republic contains several millions vertices and enormous number of arcs.
The k shortest path problem is frequently studied in literature. Plesnik presents in [3] a procedure based on prohibiting edges of till now best paths, Yen gives in [4], [5] a deviation algorithm with running time O(kn(mϩnlogn)) -this worst case assessment has been the best known for long time. Algorithm by Gotthilfa, and Lewenstein [1] (issued in March, 2009) runs in time O(kn(mϩ ϩnloglogn)).
Algorithms treated in literature have very good theoretical and practical complexity, but none of them seemed to us to be suitable for our problem -some of them seemed to be too tricky or seemed to be difficult for implementation namely because of time shortage. The requirements for our algorithm were 1. Theoretically clear and simple 2. Easy and fast implementable 3. Relatively fast even in huge graphs The result is algorithm with complexity O(Km(log(Km)ϩn)) for general directed graphs and O(Km и log(Km)) for directed acyclic graphs, where K is the number of shortest paths, n is the number of vertices and m is the number of arcs. The only nontrivial structure used in proposed algorithm is the Fibonacci heap with operations insert and extract_min,

Terminology
where V is a nonempty finite set and A is a set of ordered pairs of the type (u, v) such that u ʦ V, v ʦ V and u v.
The elements of V are called vertices and the elements of A are called arcs of the digraph G.
The elements of V are called vertices and the elements of E are called edges of the graph G.
is an alternating sequence of vertices and arcs of the form A walk, trail and path in undirected graph can be defined in an analogical way.
An arc weighted digraph G ϭ (V, A, c) is an ordered triple where G ϭ (V, A) is a digraph and c : A → R is a real function defined on the arc set A, the value c(a) for a ʦ A is called the weight of the arc a (or sometimes the arc-weight, the length or the cost of the arc a). An edge weighted graph can be defined similarly. In this paper we will assume that c(a) Ն 0. This condition is fulfilled in many practical applications.
The length of the walk (u, v) in a digraph G ϭ (V, A, c) is the total sum of arc-weights of its arcs, whereas the arc weight is added to the total sum so many times how many times it appears in the walk (u, v). The length of the walk in undirected graph is defined similarly.
The k-th shortest (s,w)-path will be denoted by k (s,w) for arbitrary w ʦ V.
For every vertex w ʦ V and for k ϭ 1, 2, ..., K we will define step by step at most K definitive three-dimensional labels  [1][2][3] be the k-th three-dimensional label assigned to a vertex w. The number k is called the rank of the label deflab[w][k] [1][2][3].
The above mentioned labels have the following meaning:  [3] and  [3] are determined for the final vertex f.
The set E will contain initially exactly all the quadruples of the form (w,c(s,w),s,1) where (s,w) FSTAR(s), i.e.
E ϭ {(w, c(s, w), s, 1 Η (s, w) ʦ A} Now E contains all the quadruples (w,t,s,k) where w is a final vertex of a (s,w)-path -namely the path s,(s,w),w; where t is the length of this path, s is the last but one vertex of this path, k=1 and this path is concatenation of k-th shortest (s,s)-path (i.e. shortest (s,s)-path) k (s,s) ϭ 1 (s,s) and s,(s,w),w = k (s,s) ᮍ (s,(s,w),w).