Finding Structurally and Temporally Similar Trajectories in Graphs

The analysis of similar motions in a network provides useful information for diﬀerent applications like route recommendation. We are interested in algorithms to eﬃciently retrieve trajectories that are similar to a given query trajectory. For this task many studies have focused on extracting the geometrical information of trajectories. In this paper we investigate the properties of trajectories moving along the paths of a network. We provide a similarity function by making use of both the temporal aspect of trajectories and the structure of the underlying network. We propose an approximation technique that oﬀers the top-k similar trajectories with respect to a query trajectory in an eﬃcient way with acceptable precision. We investigate our method over real-world networks, and our experimental results show the eﬀectiveness of the proposed method.


Introduction
Many papers in the literature have focused on extracting similarity information from sets of trajectories [1,4,3,5,7,9,16,11,12,13,14,8,15,16].Looking at the trajectories as sequences of nodes, the similarity among them can be related to the similarity among sequences.In this paper, we study how to retrieve similar trajectories constrained to follow paths in the graphs by taking into account both time and place.We aim at exploiting the topology of the network, assessing that two trajectories are similar if they pass through nearby nodes at roughly the same time.While there are measures such as the Fréchet distance for the plane, not much has been done for graphs.Indeed distances on the plane are fast to compute as we need to know just the coordinates of the points, so that measures taking into account both time and place can be computed in a reasonable time.
On the other hand, when trajectories are topologically constrained, as it happens in graphs, the distance computation between nodes is more challenging and the similarity function can turn easily into measures that are costly to compute.For this reason, the measures in the known literature that consider both time and place require that similar trajectories should pass through the same nodes.Table 1 summarizes the state of the art for the similarities of trajectories in graphs.As it can be noted, most of them require quadratic time and those requiring linear time1 have limitations: Hwang et al. [8] define the spatial-temporal similarity function so that two trajectories are similar if they pass through the same nodes at the same time.So they do not take into account the proximity of the trajectories and the closure in time of the intervals.Tikas et al. [12] remove this limitation, proposing a new similarity definition.However, their similarity works only when trajectories have the same length.As far as we know, there is no linear-time similarity that considers trajectories of different lengths and with a flexible notion of proximity in time and place.

24:2 Finding Structurally and Temporally Similar Trajectories in Graphs
In this paper, we show that it is possible to consider both time/structure for the trajectories on the graph, thus overcoming the limitations of the current literature and achieving a good compromise between time and precision.After defining our similarity function, we propose an algorithm to find the topmost k trajectories, having the highest similarity with respect to a given one.We do not put any constraint on the trajectories, and our similarity function can be computed in linear time once the pairwise node distances are given.
Our method is based on an indexing structure by using interval trees [2] to quickly find the top-k similar trajectories.To further speed up the computations, we propose an approximated similarity measure that shrinks the trajectories using the centers of the Voronoi diagram for graphs [6].Shrinking using centers is natural as, for example, a long trajectory that goes along a road network can be reasonably represented with the most famous visited places.Similarly, the trajectories on the communication networks could be represented with respect to the nodes having more traffic.
We validate our measures and algorithms in the experimental part of the paper.Due to the lack of competitors, as there are no linear-time similarities on trajectories for graphs that use flexible proximity, we design a baseline approach to compare with.The approximation methods have a good precision while the time needed to answer the query reduces significantly.

Preliminaries
Consider a network represented by a graph G(V, E), where V is the set of nodes and E is the set of edges.Let T be a set of trajectories in G, where each trajectory is defined as follows.We say that two intervals t i = [s i , e i ] and t i+1 = [s i+1 , e i+1 ], with integer endpoints, are consecutive if s i ≤ e i < s i+1 ≤ e i+1 and e i + 1 = s i+1 .
) ∈ E and t i and t i+1 are two consecutive time intervals.We call |T | = l the length of T , which corresponds to the number of (non-distinct) nodes traversed by T .Letting t 1 = [s 1 , e 1 ] and t l = [s l , e l ], we refer to s 1 and e l as the starting time and ending time of T .
Given a trajectory T ∈ T , we denote by t i = [s i , e i ] the i-th time interval of T .Note that a trajectory can pass through a node more than once.
For a trajectory T , let s and e be the starting and ending time of T .Given a time instant i ∈ [s, e], the notation T (i) indicates the unique node u ∈ V such that there exists a pair (u, t) ∈ T with i ∈ t.In the following, we use the standard notation for graphs.Given an undirected graph G = (V, E), we denote by n and m the number of its nodes and edges.We denote by D G the diameter of G and by d(u, v) the shortest path distance between nodes u and v.

Trajectory Similarity Measure
This section is devoted to introducing our similarity function.It is arguably natural to assess that two trajectories are similar if they are close to each other without necessarily sharing common nodes or having the same length.Since the motion of trajectories in this paper is constrained by the network, the similarity function will use the proximity between trajectories.As the Euclidean distance is not appropriate to measure the distance between the nodes on the graph, it is important to use the graph distance metric instead.Therefore, the distance between nodes will be combined with the time intervals at which these have been traversed.In this sense, our similarity measure will consider both aspects of the trajectories: the temporal aspect and the location of trajectories over the graph, i.e the structural aspect.
In order to define the building blocks of our similarity measure, we need first to restrict trajectories within a time interval, as shown in the following definition.

Definition 2 (Time restricted Trajectory). Given a trajectory T and a time interval t = [s, e], the time restricted trajectory T [t] is the sequence of pairs
Without loss of generality, we assume that (vi,ti)∈T [t] |t i | = |t|.We define the distance between a node v and a trajectory T within a time interval t as follows: We are now ready to introduce our similarity measure, using the distance function defined in Equation 1. Taking inspiration from [5], we aim at assigning a larger contribution to those parts of trajectories that are close for sufficiently long time intervals (while assigning lower contribution to farther parts).These desired properties are satisfied as follows.
Definition 4 (Similarity Function).Given a query trajectory Q, a target trajectory T , and a time interval t, the similarity of T with respect to Lemma 5.The similarity function Sim(Q, T, t) is always in the interval (0, 1].
By assuming It is worth remarking that whenever Proof.Looking at equations ( 1) and (2), it seems that O( 1 × 2 ) time is needed.The cost is instead O( 1 + 2 ) if we realize that the computation is conceptually a nested loop in which the nodes in Q and T are scanned forward when a pairwise distance d(v i , v) is needed: in each iteration at least one node is scanned, thus the total cost is O( 1 + 2 ).

Top-k Most Similar Trajectories
We define the problem of retrieving, in a given set of trajectories T , the top-k similar trajectories to a query in a specific time interval.More formally, this desires a set of trajectories, referred to as k-MsTraj, corresponds to the following one.

t) for each trajectory S ∈ T and T ∈ T − T .
To present a good intuition of our proposed similarity function, we provide an illustrative example of four trajectories that are randomly chosen from a dataset of trajectories moving in Milan (see Section 5.1 for more details about this dataset).By the similarity function in Definition 4, using the red trajectory in Figure 1 as query trajectory, the green trajectory has the maximum similarity among all the others, meaning that it is a solution for the k-MsTraj problem with k = 1.Note that the trajectories having color red, green, yellow and violet in Figure 1, start to move at time instances (in msec) 37237, 45964, 57354 and 26430, and stop the movement at 582313, 331565, 57872 and 564740, respectively.A straightforward approach to find k-MsTraj is to compute the similarity score for each trajectory T ∈ T and Q, reporting the k trajectories with maximum scores.Clearly we only consider those trajectories that are defined for all instants i ∈ t.This approach is inefficient as it requires O(|T | × max{|y| max , |Q|}) shortest path (precomputed) distances, where |T | and |y| max are respectively the number of trajectories and the maximum length of trajectories in T .
In the next two sections, we discuss how to accelerate this method and how to estimate similarities.

Baseline: Exact Computation of k-MsTraj
In this section, we introduce a baseline method to solve exactly the k-MsTraj problem.This is based on an indexing phase, described in Section 3.1, which aims at accelerating the query processing, as described in Section 3.2.We will use this method as a baseline in the experimental evaluation of our proposed methods.

NTrajI Indexing
The Neighborhood Trajectory Indexing (NTrajI) described here efficiently finds the closest trajectories with respect to each node of the query and its corresponding time interval.We use an interval tree, which is a binary tree storing a set of intervals based on the median of the endpoints of the intervals.In this structure, all the intervals that intersect the median point are stored in the root of the tree.The intervals lying completely to the left and the right of the median point are, respectively, stored in the left subtree and the right subtree of the root.The subtrees are constructed recursively in the same way.By using this structure, we are able to find efficiently all intervals that overlap with any given interval or point using the following well-known result.S E A 2 0 2 0 24:6

Finding Structurally and Temporally Similar Trajectories in Graphs Theorem 8 ([2]). Given a set of n intervals, an interval tree uses O(n) space, can be built in O(n • log n) time and can report all intervals that overlap a query interval or point in O(log n + k) time, where k is the number of reported intervals.
In NTrajI, we build an Interval Tree IT u for each node u ∈ V .Each IT u stores the time intervals of the trajectories in T spent in either u or the neighbors of u, and maintains the corresponding trajectories.Specifically, we have the following.Definition 9 (Node Projection Set).The projection set S u of a node u stores the pairs (t, T ) of all trajectories T ∈ T that pass through the nodes in {u} ∪ N (u) during interval t, namely, S u = {(t, T ) | (v, t) ∈ T and v ∈ {u} ∪ N (u) and T ∈ T }, where N (u) is the set of neighbors of u in the graph.
The Interval Tree IT u maintains all the pairs (t, T ) ∈ S u for each node u ∈ V .Each entry of IT u is of the form t, id , where id is the trajectory identifier and t is the time interval spent in {u} ∪ N (u) by the trajectory id.Note that there can be more than one pair associated with node u and the same trajectory id, since each trajectory can traverse u multiple times.
By Theorem

Query Processing
We introduce a pruning technique as the baseline method to the k-MsTraj problem (see Algorithm 1).The baseline method explores the set Γ of trajectories that are most promising to be k-MsTraj.They are discovered by searching through the NTrajI index.By exploiting Γ, the baseline method computes the similarity score of each trajectory in Γ and finds the trajectories having the highest similarity with Q within the time interval t.
Therefore, the main task is to construct the candidate set Γ using NTrajI.In particular, for a given query trajectory Q, we first restrict query Q within the time query t, obtaining Q[t].Then, for each (v i , t i ) ∈ Q[t], we aim at finding the trajectories that are close to v i within t i .To this aim, for each (v i , t i ) ∈ Q[t], we search through IT vi , by NTrajI-search(v i , t i ) in Algorithm 1, to build Γ (vi,ti) .So we have Γ = (vi,ti)∈Q[t] Γ (vi,ti) .We compute the similarity score with respect to the function in Definition 4, for each trajectory in Γ.In order to maintain the k trajectory ids with the highest similarity score during the search process, we use a heap H, whose top-k entries represent k-MsTraj.

Approximated Computation of k-MsTraj
The baseline method described in Section 3 is costly when the number of trajectories in T is large.To accelerate the searching process, we propose some approximated methods with two-phase preprocessing as discussed in Section 4.1.
First, we partition G into disjoint groups of nodes, precomputing the distances among the centers of each group.As the similarity function in Definition 4 uses the shortest path distance between nodes of the graph, we aim at approximating distances inside the graph using the distances from the centers of the groups.Second, we adapt the NTrajI indexing so that we maintain trajectories among the groups in a structure called VoTrajI.
For the query processing, given a query trajectory, we show how to estimate the similarity scores for the trajectories in T using the partitioning and the new VoTrajI index in Section 4.2

Two-phase Preprocessing
The partitioning takes into account node popularity by choosing the nodes having a higher number of trajectories passing through them as the centers of the groups.To do this, it uses Voronoi Diagrams for graphs (V DG), as explained next.
The V DG is a generalization of the classic Voronoi diagram.For graph G = (V, E) and a set of trajectory T , let C = {c 1 , c 2 , . . .c h } be a set of h (most popular) nodes in V , called Voronoi sites i.e. center nodes.The V DG over the nodes in C is defined as a partition of V into h groups g 1 , g 2 , • • • , g h , one for each center in C. Node u ∈ V is in group g i with center c i (i.e.g i .C = c i ) iff d(u, c i ) ≤ d(u, c j ) for each c j ∈ C with i = j (ties are broken arbitrarily).We can divide G into h Voronoi groups in O(n log n) time when h = O(n ) for a positive constant < 1 [6].
Once the Voronoi groups have been computed, we precompute and store the pairwise distances among the center nodes of the groups.Our aim is using these distances as an approximation for the distances required by the similarity function in Definition 4. By running one BFS for each center node, we compute the distance between each pair c i , c j ∈ C in O(m • n 1/2 ) time, where we set h = n 1/2 .As a result, we obtain the following lemma.The Interval Tree IT c for each node c ∈ C maintains all pairs (t, T ) ∈ S c .Each entry of IT c is the form of t, id , where id is the trajectory id, and t is the time interval that the trajectory id spent at v ∈ g, where g.C = c.
To reduce the storage space used by IT c , for each c ∈ C, we consider a sequence of consecutive time intervals with the same trajectory id in S c as a single time interval with the corresponding trajectory id.

Query Processing
Consider how a trajectory T ∈ T is represented with respect to the center nodes of the Voronoi diagram.Let (v i , t i ) ∈ T and v i ∈ g, where g is a Voronoi group of G.We represent (v i , t i ) ∈ T as (c, t i ) where g.C = c.We obtain a new trajectory T as a sequence of center nodes and the corresponding time intervals.Note that T can traverse a sequence of the nodes belonging to the same Voronoi group within consecutive time intervals.To avoid the duplication of nodes for consecutive time intervals, we define shrunk trajectories.
Given a trajectory T = (c 1 , t 1 ), . . ., (c l , t l ) , consider the operator shrink(T ), which recursively merges any pair (c i , t i ), (c i+1 , t i+1 ) ∈ T as (c i , t i + t i+1 ) when c i = c i+1 and t i , t i+1 are two consecutive time intervals (here operation t i + t i+1 gives [s i , e i+1 ]).Definition 14 (Shrunk Trajectory).Let T = (v 1 , t 1 ), . . ., (v l , t l ) be a trajectory in T .Consider the corresponding sequence T = (c 1 , t 1 ), . . ., (c l , t l ) with respect to the Voronoi groups.We define the shrunk trajectory of T as T = shrink(T ).Both variants perform a search on the VoTrajI index using the shrunk query trajectory Q.The outcome of that search is a set Γ, which is defined as Γ in Section 3, except that we use VoTrajI in place of NTrajI.This makes a difference, as the property in Proposition 10 does not necessarily hold anymore.Indeed there could be a trajectory T ∈ k-MsTraj such that T ∈ Γ (whereas surely T ∈ Γ).This approximated version has the advantage of speed, which motivates this study.

Variant SHQ
In this variant we compute the similarity scores for each trajectory T ∈ Γ with respect to the shrunk query Q.In particular, we make an estimate of Sim(Q, T, t) as Sim( Q, T, t), and report the top-k trajectories with the highest estimated similarity score.To measure the precision ratio of this estimation, the similarity function makes an estimate of d = d(v, u) as d = d(c, u), when v ∈ Q, u ∈ T , and c is the center node of a group that includes v.Although we reduce the number of nodes in the query trajectory which needs to be processed, the number of distances involved is still large.As mentioned earlier, the cost of distance computation depends on the length of the trajectories within the query time interval t.In order to reduce this cost, we consider our second variant SHQT.

Variant SHQT
In this variant, we estimate Sim(Q, T, t) as Sim( Q, T , t).Specifically, the similarity function makes an estimate of d = d(v, u) as d = d(c i , c j ), when v ∈ Q, u ∈ T , and c i , c j are the center nodes of the groups that include v ∈ Q and u ∈ T , respectively.Lemma 16.For any two distinct nodes v, u belonging to Voronoi groups with center nodes c i , c j , respectively, the ratio between Proof.As illustrated in Figure 2, let dist(v, c i ) = r and dist(u, c j ) = r .We consider the groups g i , g j containing the two centers c i , c j , respectively.The similarity function in Definition 4 assigns a larger contribution to those nodes of the trajectories that are closer to each other, rather than the farther ones.Thus, by Lemma 15 and 16, we expect that the estimated similarity score in both variants is larger than the exact similarity score.We will evaluate this idea in our experiments.

Experimental Evaluation
This section is devoted to comparing the performances of SHQ and SHQT with respect to the baseline method, hereafter called BASE.The evaluation aims at providing a response to the following questions.Q1: How fast is getting the answer for a query, i.e. how much is the query time?Q2: How fast is the preprocessing phase?Q3: How good is the quality of the solution found if compared with the exact solution?
S E A 2 0 2 0 24:10 Finding Structurally and Temporally Similar Trajectories in Graphs We will respond to these questions by evaluating the performance of each method for different value of k.In particular, we set k as 2 i for i = 0, . . ., 6.Each experiment requires a graph, a trajectory set, and a query trajectory.For each experiment, we choose 100 trajectories as query trajectories, randomly.
Our computing platform is a machine with Intel(R) Xeon(R) CPU E5-2620 v3 at 2.40GHz, 24 virtual cores, 128 Gb RAM, running Ubuntu Linux version 4.4.0-22-generic.The source code has been written in Python3.

Datasets
We conduct our experiments on real-world graphs, using synthetic and real trajectories, whose properties are shown in Table 2.
Facebook Synthetic trajectories from Facebook social network.2Milan Dataset based on GPS tracks of private cars in Milan.First, we build the graph by making use of the GPS trajectories.Then, we cluster the close nodes with k-Means.
There is an edge between two clusters i and j if there exists at least one trajectory going through i, j, consecutively.3Rome Dataset of Flickr geo-tagged photos provided by [10], containing tourist trajectories covering Rome.We build the graph of the Points of Interest (in short, PoIs).

Query Time
In the following, we compare the query time of the three methods.Table 3 reports our results, showing the average query time over 100 queries in each dataset.As it can be seen, both SHQ and SHQT variants outperform BASE.The most evident benefit can be seen for the biggest dataset that we considered, i.e.Milan dataset.In this case, SHQT spends less than 23% of the time needed by BASE and SHQ.We report in Table 4 the number of candidate trajectories for all the methods (i.e.|Γ| and | Γ|).The table shows that SHQ and SHQT select more candidates than BASE.This is not an issue as, even if we have to process these extra trajectories, they compute much fewer query distances and consecutively spend less time than BASE, as shown in Table 3.
For the sake of completeness, we also analyzed the behavior of our method when the length of the queried trajectories varies for the case of the Facebook dataset.As we can see in Figure 3, SHQ and SHQT outperform BASE.Actually SHQT significantly outperforms the other two, and the improvement becomes even more evident when the length of the query trajectory increases.As the length of the query goes up to 80, the time needed by BASE   and SHQ increases faster than the SHQT.This observation confirms that shrinking both target and query trajectories reduces the number of distance computations and thus the time reduced greatly.
Figure 4 shows the average number of trajectories in the candidate set for each method.Note that the number of trajectories in the candidate set for both methods SHQ and SHQT is the same since we use the same approach for specifying Γ.As it can be seen, by increasing the length of the query up to 40, the number of trajectories in the candidate set for each method increases quickly to more than 240, and then becomes the same for all of them.This confirms the role of the precomputed distances among Voronoi centers to accelerate query processing.The time cost of this precomputation is negligible.Moreover, by Lemmas 15 and 16, we would expect that the similarity score would be larger when we shrink trajectories: looking at Figure 5, we observe that the similarity scores by shrinking trajectories behave as we expected.

Preprocessing Time
As we mentioned before, between SHQT and SHQ, only the former uses the precomputed distances.The cost of the precomputation is shown in Table 5.We also report the time needed to index and shrink trajectories.In particular, columns NTrajI and VoTrajI report the time needed for building respectively the indexing structures NTrajI and VoTrajI.As expected, the time needed for building NTrajI over the trajectories in the Facebook dataset is larger than the one required by other datasets.This is due to the presence of longer trajectories with respect to other datasets.The column Distance Precomputing shows that the time needed to precompute the distances is negligible.Finally, we can observe that the time needed to perform the Voronoi partitioning and shrinking trajectories in the last column is also negligible in comparison with the time needed for building NTrajI, which clearly dominates the cost.

Quality and Evaluation Metrics
We evaluate the quality of the solution produced by the SHQ and SHQT methods with respect to BASE.The effectiveness of the methods is assessed by means of the metrics that we describe next, where the values close to 1 are more desirable.Let γ 1 and γ 2 be two output sets containing top-k trajectories, e.g. the exact and approximated solutions. .

2.
We define the intersection ratio as IR(γ 1 , γ 2 ) = It is worth remarking that the running time of the methods does not change for the different values of k.
Our results are shown in Figures 6 and 7, where the IR and SSR ratios are reported as a function of k.In particular, Figure 6 represents the IR ratio for increasing k values in the three datasets.The IR ratio goes up to more than 0.80 quickly, by increasing the value of k on the Facebook network.On the other hand, this value in Milan and Rome networks becomes close to 0.3.However, we observe that the lower values of IR correspond to SSR values that are close to 1. Indeed, Figure 7 shows SSR which is almost always very close to 1 and that gets more close to 1, while increasing k.

Figure 1
Figure 1 An example including 4 random trajectories in a dataset of trajectories moving in Milan.The trajectory with the red color is a query.The green trajectory is the most similar one by Definition 4.

Lemma 11 .Finding
Graph partitioning and centers distance precomputation require O(m • n 1/2 ) time.The space required by the centers distance table is O(n) space.We now discuss how to build the Voronoi Trajectory Indexing (VoTrajI) by adapting the NTrajI data structure.We use an interval tree IT c for each c ∈ C. Interval tree IT c stores the time intervals of trajectories in T spent within the nodes in g, when g.C = c.The VoTrajI maintains the corresponding trajectory ids of the time intervals.By modifying Definition 9, we have: Structurally and Temporally Similar Trajectories in Graphs Definition 12 (Group Projection Set).The projection set S c of a center node c ∈ C stores the pairs (t, T ) of all trajectories T ∈ T that pass through the nodes in g, when g.C = c, namely, S c = {(t, T ) | (v, t) ∈ T and v ∈ g and g.C = c and T ∈ T }.

Lemma 13 .
The two-phase preprocessing takes O(m • n 1/2 ) time and O(n) space.
Note that it takes O(l) time to obtain T , and that | T | ≤ |T |.At this point, we consider two variants for estimating k-MSTraj.SHQ Shrunk Query: Shrinking trajectory Q during query time.SHQT Shrunk Query and Target: Shrinking each trajectory in T during the preprocessing and shrinking trajectory Q during query time.

Lemma 15 .
For any given v, u ∈ V , u = v, the ratio between d = dist(v, u) and d = dist(c, u), where c is the center of Voronoi group containing v, is bounded as 1 ≤ d/ d ≤ 3. Proof.Let dist(c, v) = r.We have two possibilities.If r ≤ 2 d, then by triangle inequality d ≤ r + d and thus d ≤ 3 d.Else if 2 d < r, then by triangle inequality r ≤ d + d and thus d < d.
By triangle inequality we have d ≤ r + d.Since u ∈ g j and u / ∈ g i then r ≤ d.Thus, d ≤ 2 d.Using Lemma 15 and 16, we are able to conclude that d ≤ 2d when r > 2 d.If r > 2 d by triangle inequality we have d < d.Since d ≤ 2 d, we can obtain that d ≤ 2d.

Figure 2
Figure 2 ci ∈ gi and cj ∈ gj such that ci, cj ∈ C.

Figure 3
Figure 3 Average time vs length of queried trajectories in Facebook dataset.

Figure 4
Figure 4The average number of trajectories in candidate set in each method vs length of query in Facebook dataset.For both SHQ and SHQT the candidate set Γ is the same.

Figure 5
Figure 5 The comparison between similarity scores of each method.

Figure 6
Figure 6The quality of the results returned by the competitors in terms of IR ratio vs k.

Figure 7
Figure 7The quality of the results returned by the competitors in terms of SSR ratio vs k.

Table 1
Graph-based similarity measures for trajectories of nodes.

24:4 Finding Structurally and Temporally Similar Trajectories in Graphs dist
(v, T, t) = 1 if and only if for each time instant i ∈ t, node T (i) is at distance D G from v.This corresponds to the case where T spends the whole time interval t on nodes of G that are maximum distance from v.
8, we can derive that NTrajI uses O(|T | × |y| max × ∆) space, where ∆ denotes the maximum degree of G.For a given node u and a time interval t, let Γ (u,t) denote the trajectories that traverse either u or N (u) within t.By searching over the NTrajI, we are able to find Γ (u,t) efficiently by taking O(log |Γ u | + |Γ (u,t) |) time, where |Γ u | is the size of IT u and |Γ (u,t) | is the number of reported trajectories.

Table 2
Summary of Datasets.Recall that DG is the diameter of G.

Table 3
The average time for answering a query for each method (in sec).

Table 4
The average number of trajectories in the candidate set in each method.For the Facebook dataset, refer to Figure4.

Table 5
Preprocessing time (in sec).We define the similarity score ratio as the ratio of the average similarity scores of trajectories in γ 1 and γ 2 .Namely, SSR(γ 1 , γ 2 ) = T ∈γ1 Sim(Q, T, t)