Research Article

Finding the Shortest Path with Vertex Constraint over Large Graphs

Algorithm 2

APPROXIMATE-PATH ().
Input:.
Output:.
// Input: : an undirected weighted graph
// : a vertex subset of
// , : starting vertex and ending vertex respectively
// Output: : the approximate shortest path between and
// with vertexconstraint of
1: Let be a min priority queue with the entries in the form , sorted in the ascending order of
, where is the shortest distance between and ;
2: ;
3: for  each    do
4: Enqueue an entry into ;
5: , ;
6: while    do
7: Dequeue the first entry from ;
8: if    then
9: continue;
10: else
11: , ;
12: for  each    do
13: Enqueue an entry into ;
14: ;
15: Traverse by preorder and let be a permutation corresponding to the order of
vertices in preorder traversal on ;
16: Move the ending vertex to the end of to get ;
17: Generate the shortest path between and under a permutation ;
18: return  ;