An Efficient Dynamic Programming Algorithm for Finding Group Steiner Trees in Temporal Graphs

,

Tis study analyzes the computation of GST for temporal graphs, i.e., the computation of temporal GST (TGST).Calculating GST for temporal graphs is quite useful, for example, querying the relationship between authors in DBLP throughout various time intervals, evaluating the propagation of viruses or messages in social networks, and querying routes to a group of POIs in a public transit network.
Based on the abovementioned application, we studied the computation of GSTs in temporal graphs, namely TGST.Specifcally, given a weighted and labeled temporal graph G, where each vertex is associated with a set of labels, our approach searches for the minimum-weighted connected tree from G that covers all the specifed given labels.
In reality, the conventional GST in a static (nontemporal) graph is a classical problem.However, the existing GST solutions cannot be suitable for our problems because the temporal information is not considered.Terefore, the dynamic programming algorithm is often used in the existing solutions.Ding et al. [18] presented a parameterized dynamic programming algorithm has been presented which takes O (3 where k is the number of specifed labels, and m and n are the number of edges and vertices of the graph, respectively.Owing to the exponential time complexity, the parameterized algorithm is impractical even for a very small value of k (e.g., k = 8) in large graphs.Terefore, an improved dynamic algorithm was devised in [20].
Similar to the existing methods, we present an efcient solution based on a dynamic programming algorithm for our problem.Specifcally, we defne a state as a connected tree in the given temporal graph.Our approach difers from those proposed in [18,20] in that our state contains the directed edges associated with time information.Moreover, we propose three state-transition operations, namely, edge-growth, treemerger, and path-growth.Similar to the approaches in [18,20], the edge-growth combines a state with an edge into a new state, and tree-merger combines two states into a new state.In particular, the path-growth corresponds to a series of edgegrowth and tree-merger operations, which can reduce the number of states to be generated.Consider the huge size of a temporal graph.We propose a new method called graph simplifcation, by which we can obtain a smaller-size temporal graph.In addition, we propose an enhanced method based on the A * search strategy, which can dramatically reduce the number of states in the search space.
To the best of our knowledge, this is the frst study to focus on the computation of TGST.Specifcally, our main contributions are summarized as follows.(1) A dynamic programming (DP) algorithm for TGST is proposed, which adopts the proposed graph simplifcation and state pruning techniques.Moreover, we use the A * search strategy to further speed up DP and design an enhanced algorithm called DP+. (2) Tis study also presents the following problem extension.First, we consider the TGST with an unspecifed tree root, as the root node of TGST may be unspecifed.We propose a modifed version of the DP algorithm for solving the extension problem.Second, we consider the progressive search of TGST.In particular, in practice, a user may prefer a suboptimal solution in less time instead of waiting for the algorithm to fnd the optimal solution.Terefore, we analyzed the progressive search that produces progressively refned feasible solutions during algorithm execution.Tird, the user may want to obtain multiple optimal solutions.Terefore, the top-N GSTs were considered to fnd the optimal N solutions ranked using a cost function.(3) We conducted a set of experiments based on fve real temporal networks.Te experimental results further verify the efciency of our algorithm.Compared with the baseline algorithm, our proposed algorithm is faster by several orders of magnitude.In addition, we present a case study to show the efectiveness of our algorithm.
Tis paper is organized as follows.Section 2 contains our problem defnition.Section 3 introduces the dynamic programming algorithm and the proposed optimization techniques.Section 4 is the extension for our problem.Our empirical study is reported in Section 5, and the related work is discussed in Section 6.We conclude in Section 7.

Problem Definition
Tis section presents our problem of TGST and presents some defnitions and notations used in this study.

Temporal Graph.
Let G = (V, E) be a temporal graph, where V (E) is the set of vertex (edge) of G.In particular, there may be multiple directed edges between two vertices in G.Each edge e ∈ E is defned to be a quintuple which includes a starting vertex u, an end vertex v, a starting time t u , an arrival time t v , and a weight value w, denoted as e = (u, v, t u , t v , w), where t u , t v , and w are nonnegative real numbers, and t u ≤ t v .Te starting vertex, end vertex, starting time, arrival time, and weight value of e are also denoted by s(e), a(e), t s (e), t a (e), and w(e), namely s(e) = u, a(e) = v, t s (e) = t u , t a (e) = t v , and w(e) = w.For simplicity, we sometimes write e as e = (u, v).
For any vertex u ∈ V, let E i (u) and E o (u) denote the sets of in-edges and the set of out-edges of u, respectively.Ten, Example 1. Figure 1(a) illustrates a temporal graph containing eight vertices numbered 0-7 and 13 edges, e 1 , e 2 , e 3 , . .., e 13 .Each edge is labeled with a serial number, [t u , t v ] and [w].In this example, we set the edge weight w as the time duration, namely t v − t u .In practice, w can be set as any value.In this fgure, the edge e 1 = (0, 1, 1, 5, 4) indicates a bus route from 0 to 1 with the departure time t u = 1, the arrival time t v = 5, and the cost w = 4. Furthermore, the set of inedges and out-edges of the vertex 1 is defned as E i (1) = e 1 ,  e 7 } and E o (1) = e 4 , e 5 , e 6  , respectively.Path P = 〈e 1 , e 2 , . .., e k 〉 in G is a sequence of edges such that a(e i ) = s(e i+1 ) and t a (e i ) ≤ t s (e i+1 ), where 1 ≤ i < k.We say that P is a path from the vertex s(e 1 ) to the vertex a(e k ).Te starting edge and end edge of P are e 1 and e k , respectively.We denote t s (e 1 ) as the starting time and t a (e k ) as the arrival time of P, calculated as S(P) and A(P), respectively.Te weight or cost of P is formulated as W(P) =  e∈P w(e).
We call requirement t a (e i ) ≤ t s (e i+1 ) as the path time constraint.For example, in transportation networks, each directed edge implies a bus route, and the departure time of e i+1 initiates after the arrival time of e i .Moreover, the edge durations may be denoted as zero for some temporal graphs such as e-mail communication and Facebook wall posting.
We can say that a path P is satisfed with the time interval We say that a connected tree T in G is satisfed with [t α , t β ] if all paths from the root to each leaf vertex are reachable in [t α , t β ].Similarly, the weight or cost of T is defned as the sum of the weight of each edge included in T, namely, W(T) =  e∈T w(e).

2
International Journal of Intelligent Systems

Our Problem
Defnition 2. (TGST).Given a temporal graph G = (V, E), each vertex v ∈ V is associated with a set of labels L v .Let L = ∪ v∈V L v be the set of all labels.Given a root r ∈ V, a set of query labels L ⊆ L, and a time constraint [t α , t β ], our approach involves the fnding of a minimum weight tree, T, from G that is rooted at r, satisfed by [t α , t β ], and contains all labels in L. For simplicity, we assume that L r = ∅, as we can always exclude L r from L.
Consider Figure 1(a) as an example, where vertex 0 is defned as root r, and Let P(r, v) be the set of all paths from r to v that are satisfed with [t α , t β ].If P ∈ P(r, v) has the earliest arrival time among all paths in P(r, v), we defne arrival time A(P) as the earliest arrival time for v, denoted by  A(v).In particular, if there is no path from r to v, we set  A(v) = ∞.For example, in Figure 1(a), let r be the vertex 0,  A(7) = 9, and  A(6) = ∞.Te existing GST problem in a weighted and labeled graph, in which the vertices with the same labels are in the same group, is the generation of the Steiner tree problem [21].Te existing GST problem is known to be NP-hard [14].As additional time information is contained in a timetable graph, the existing GST problem can be viewed as a special case of our problem.Tus, we defne the following theorem.Theorem 3. Our problem is NP-hard.

Motivation for TGST.
Our work is motivated by a number of applications.A TGST can identify user relationships at diferent time intervals in social networks.A TGST is also useful for the study of epidemiology, the paths of infectious diseases (or computer virus), when the network is about individual contacts (or a computer network).Another application is the transportation problem cited in [22].A TGST minimizes the total cost to transport some given POIS.Some motivation applications are as follows.
Motivation 1.Consider a temporal network record when two nodes have interacted such as virus infection or e-mail forwarding.A TGST can be adopted for reconstructing the fow of epidemic propagating in temporal networks.Tat is, given a temporal network in which a virus has been propagating over time, we can identify the starting points of the epidemic and tell when every node got infected.In particular, each node can be associated with the types of viruses.In order to better understand the real viruses spread over time, we consider the spread of related types of viruses.When one virus spreads to a node such as the coronavirus, it is possible that this virus will not appear in the next node, but the related virus could appear such as the helicobacter pylori.If the edge's weight is set as the afected time of viruses, a TGSTcan tell the propagation paths of the specifed types of viruses with minimum afected time.A case study for this observation is given in Section 5. Motivation 2. We consider an application of the DBLP graph, where each vertex corresponds to an author or a paper and each edge denotes a certain relationship (e.g., coauthor/cited by/written by) among the authors and the papers.An edge is more important if it has a smaller weight.Our solution can be used to fnd out the closest connections from the DBLP graph that covers the given authors within a given period.For example, from 2016 to 2018, Tom and Peter coauthored three papers that were cited by one paper written by Jack in 2019.Te found connections can be highly useful and important for network analysis.Motivation 3. A public transportation network can be modeled as a timetable graph [23], where each node represents a station, and each directed edge is associated with a timetable that records the departure (resp.arrival) time of each vehicle from a station to another.Moreover, each node is associated with some POI category keywords or labels, and each edge has a travel cost weight such as the distance and time duration.A TGST minimizes the total cost to transport some given resource from a given location to all the stations associated with the given set of POIs.

Our Solution
In summary, our solution adopts a DP paradigm similar to that proposed in [18,20], in that we utilize the similar state representation and state-transition equation.In fact, the approach used in [20] is an improved version of that in [18] for an undirected static graph, in which some optimization techniques are proposed to reduce the search space.
To design our solution, we considered the following naive method based on an adaption version of [20].First, we obtained a state queue, in which a set of initial states are stored for each vertex and query label.In addition, an upper bound weight of a feasible solution is stored.Second, the state with the minimum weight value in the queue is expanded using the edge-growth and tree-merger operations to generate a new state.Tird, check whether the new state is an optimal solution.If yes, then that state is returned as an answer.Otherwise, if the state weight is less than the upper bound, it is used to update the state queue and upper bound.Ten, the next state in the queue is checked, and the state expansion is continued in the second step.
However, note that some important properties in [20] do not hold for our problem.For example, in the A * search, the lower bound for each state is based on the fact that the root of a state can reach to any vertex covering the labels in an undirected graph.
Tus, we must design new optimization techniques for the adaption version.First, as discussed in Section 3.1, we attempt to simplify the given temporal graphs and present a new method called graph simplifcation, which can extract several edges and vertices from the given temporal graph.In general, the graph simplifcation takes O(|E|) time.In addition, we present an upper bound for our problem based on the simplifed temporal graph.Second, we try to reduce the states to be generated using the edge-growth and treemerger operations.Tus, we present a new stateexpansion operation, namely, the path-growth operation, as discussed in Section 3.2.Te path-growth operation expands a state by a path instead of an edge.Note that the edge-growth and tree-merger operations are not necessary for expanding the state in terms of the edges contained in the path.Tird, we try to reduce the states that have been generated in the search space.Terefore, in Section 3.2, we present a state pruning operation to remove the bad states from the search space.Moreover, based on the enhanced A * search strategy, we propose an efective lower bound for each state to prune the generated states.
Note that a previous related study focused on how to reduce the generated states in the search space ([20]).However, studies have yet to devise a method to reduce the graph size and number of states to be generated.

Graph Simplifcation.
First, we introduce some important properties that are the basis of graph simplifcation.

Lemma 4. Given a temporal graph G = (V, E) and a set of query labels L, for any vertex
Te correctness of Lemma 4 can be easily verifed based on our problem defnition.Lemma 4 shows that from G, vertices with out-degrees equal to zero and not containing labels in L can be easily removed.For example, as shown in Figure 1(a), if L = c { }, vertices 4, 6, and 7 can be removed.We can continue to remove vertex 3 in the remaining graph as it does not contain the labels in L and its out-degree is zero.Te removal process is then halted as there are no such vertices remaining.
For any vertex v ∈ V, we can obtain the earliest arrival time for v (i.e.,  A(v)) by using the time-minimum spanning tree algorithm with linear time [3].Ten, we achieve the following Lemma 5.
Lemma 5. Given a temporal graph G = (V, E) and a root r ∈ V, for any edge e ∈ E, if t s (e) <  A(s(e)), e can be removed from G.
Proof.For any edge e = (u, v, t u , t v , w) ∈ E, we have t s (e) = t u and s(e) = u.Ten,  A(s(e)) =  A(u) corresponds to the earliest arrival time among all paths from the root r to u.As t u <  A(u), the path time constraint does not hold.Terefore, edge e cannot be included in any path from r to v, and it can thus be removed.
By using Lemma 5, we can continue removing edges from G. For example, in Figure 1(a), let vertex 0 be the root.As t s (e 4 ) = 3 <  A(1) = 5, edge e 4 can be removed.Specifcally, the key steps of graph simplifcation are as follows.
Step 1: Simplify the temporal graph according to time constraint [t α , t β ].For each edge e ∈ E, if t α ≤ t s (e) ≤ t a (s) ≤ t β does not hold, remove the edge e from G Step 2: Simplify the temporal graph according to the earliest arrival time (1) Use the time-minimum spanning tree algorithm [3] to obtain the earliest arrival time  A(v) for each vertex v ∈ V (2) For each edge e ∈ E, if t s (e) <  A(s(e)), remove the edge e from G Step 3: Simplify the temporal graph according to the set of query labels.
(1) Traverse G and fnd all vertices, with zero as the outdegree and which do not contain labels in L. Store these vertices in queue Q. (2) For each vertex v ∈ Q, remove v and remove all edges in E i (v) from G. Ten, for each edge e ∈ E i (v), decrease the out-degree of the vertex s(e).If the out-degree of s(e) � 0 and s(e) does not contain any label in L, add s(e) into Q.
After the key steps are run, there may exist isolated vertices that do not connect with other vertices; these must also be removed.Ten, we obtain a simplifed temporal graph denoted by G s (V s , E s ).Te main time cost for both the frst and third steps is equal to the cost for traversing the Next, we present an upper bound based on G s (V s , E s ) for our problem.
Lemma 7. Given a simplifed temporal graph G s , let P 1 , P 2 , . .., and P m be the minimum weight paths from the root r to each vertex covering the labels in L.
, where e 1 , e 2 , . .., e k are all distinct edges contained in P 1 , P 2 , . .., P m , UB is an upper bound for our optimal solution.
Proof.Te optimal solution is a minimum weight tree comprising paths from root vertex r to each vertex covering the labels in L. Clearly, the optimal solution does not comprise duplicate edges.As P 1 , P 2 , . .., P m are all such paths with minimum weights and e 1 , e 2 , . .., e k are all distinct edges contained in these paths, the weight of the optimal solution is not larger than UB.

□
Example 8. Consider Figure 1(a) as an example, where We obtain the simplifed graph, G s , comprising all edges except e 4 and e 10 , as these were removed according to Lemma 5, and all vertices except vertex 6 as it is isolated.Ten, we obtain the minimum weight paths from root 0 to the vertices covering the labels in L, namely P 1 = 〈e 3 〉, P 2 = 〈e 2 , e 8 , e 13 〉, P 3 = 〈e 2 , e 8 〉, and P 4 = 〈e 2 〉.Ten, UB = w(e 2 ) + w(e 7 ) + w(e 8 ) + w(e 13 ) = 5, where e 2 , e 3 , e 8 , e 13 are all distinct edges contained in these paths.
In general, the minimum weight paths can be obtained as follows.(1) Te simplifed temporal graph, G s , is transformed into the directed weighted graph, G s by using the graph transformation method in [3].(2) Ten, any path in G s has one corresponding path in G s , and both these paths have the same weight.By executing the Dijkstra algorithm [24] on G s , we can obtain the minimum weight paths in G s , that is, from root r to each vertex, covering the labels in L. Te process utilizes O(|E| + |V| • log|V|) time.

State Pruning.
In our algorithm, a state denoted by (v, X, t) corresponds to a connected tree in G that is rooted at v and covers all labels in X, where t is the earliest starting time among the out-edges of v contained in the tree.Ten, let T(v, X, t) denote the tree with the minimum weight among all such trees.For example, state (0, a, b, c, d { }, t s (e 2 )) corresponds to the tree in Figure 1(b).As the tree has the minimum weight, it corresponds to T( 0, a, b, c, d { }, t s (e 2 )).Ten, the state-transition equation is formulated as follows: T g s(e), X, t s (e)  = min As shown in equation ( 1), T(v, X, t) is constructed from either T g (v, X, t) or T m (v, X, t) with the minimum weight, which is constructed using the edge-growth operation in equation or the tree-merger operation in equation ( 3).Specifcally, for any state (u, X, t), the edge-growth operation must be used to examine each in-edge e of u individually and then construct a new tree T g (s(e), X, t s (e)) by combining edge e and tree T(u, X, t), where t a (e) ≤ t.Note that label set X is unchanged in the edge-growth operation.However, for any two states (v, X 1 , t 1 ) and (v, Te set of labels of the expanded state then becomes larger in the tree-merger operation.

Pruning by Using the Path-Growth Operation (P1).
In general, the path-growth operation merges a state with a path instead of an edge.As a path often contains multiple edges, the path-growth operation corresponds to a series of edge-growth and tree-merger operations.Ten, the number of states to be generated by the path-growth operation can be reduced.
Defnition 9 (State path).For any state (v, X, t), let P(v, t) = P | P ∈ P(r, v)∧A(P) ≤ t { }.If P v,t ∈ P(v, t) has the minimum weight among all paths in P(v, t), P v,t can be called the state path of (v, X, t).
For any state (v, X, t), there are two cases.Case 1: . First, we consider Case 1.Let ψ(P v,t ) denote the set of labels contained in the state path P v,t .Te path-growth operation is formulated as follows.
Defnition 10 (Path-growth).For any state (v, X, t), if { }, the path-growth operation on (v, X, t) merges P v,t and T(v, X, t) into a new tree, and it is defned as

t) is a feasible solution that has the minimum weight among all feasible solutions containing T(v, X, t).
Proof.According to Defnition 10, )) is a tree rooted at r and contains all International Journal of Intelligent Systems labels in L. Tus, (r, X ′ , S(P v,t )) is a feasible solution, denoted by T 1 .Next, we show that T 1 has the minimum weight among all feasible solutions containing T(v, X, t).Suppose that T 2 is another feasible solution.Ten, there exists a path P ′ ∈ P(v, t) (P ′ ≠ P v,t ), which can be merge with T(v, X, t) into T 2 .As P v,t has the minimum weight among all paths in P(v, t), we have Next, considering Case 2, we propose the following lemma.
) is an upper bound of the weight of the optimal solution.
Proof.Without loss of generality, suppose that there exist two common vertices u and v included in both P v,t and T(v, X, t), as shown in Figure 2(a).As shown, P v,t corresponds to the path from root r to v, denoted by the dashed line.T(v, X, t) corresponds to the tree rooted at v and contains vertices v, u, y, and the other vertices.In addition, the triangle is used to represent the other vertices.Suppose that ψ(P v,t ) ∪ X = L.For simplicity, the labels associated with each vertex are not given in Figure 2.
Let G ′ denote the cycle graph in Figure 2(a), which corresponds to the merger of P v,t and T(v, X, t).By removing the edge from v to u in G ′ , we obtained tree T ′ rooted at r, as shown in Figure 2(b).Evidently, T ′ and G ′ contain the same set of vertices.Ten, T ′ contains all labels in L. Tus, T ′ is a feasible solution.As T ′ has less number of edges, W(T ′ ) ≤ W(G ′ ) = W(P v,t )+W(T(v, X, t)).□

Pruning by the Bad States (P2).
Given any two generated states, they may have the same root but diferent weights and time values.Te state with a smaller time value and a larger weight value is called a bad state that can be pruned.
Lemma 13.For any two states (v, X, t 1 ) and (v, X, t 2 ), if Proof.Consider the edge-growth operation.First, we examine T(v, X, t 2 ) by using equation (2).For each edge e ∈ E i (v), if t a (e) ≤ t 2 , we merge both e and T(v, X, t 2 ) into a new tree T 1 as follows: Next, we examine T(v, X, t 1 ) using equation (2) As t a (e) ≤ t 2 ≤ t 1 , we merge both e and T(v, X, t 1 ) into a new tree T 2 , as follows: T 2 = e ⊕ T(v, X, t 1 ).
Similarly, for the tree-merger and path-growth operations, T(v, X, t 2 ) does not need to be expanded further.Tus, T(v, X, t 2 ) can be pruned.Te simplifed graph G s (V s , E s ) and upper bound UB are obtained as shown in lines 1-6.Queue Q is used to store the expanded states, which are sorted according to their weights in the ascending order.In the beginning, for each vertex v in V s and each label l in L v ∩ L, we construct an initial state Te earliest starting time and cost value for s o are set to be ∞ and zero, respectively.Tis is because in s o comprises only a single vertex v and no edge.Ten, we push s o into Q.Queue D is used to store the states that pop from Q.
Lines 7-25 show that if Q is nonempty, the DP algorithm repeats the pop/push operation to grow/merge the states individually to obtain the optimal solution.Specifcally, the algorithm pops (line 8) the top state T(v, X, t) that has the minimum weight among all states in Q.If T(v, X, t) covers all labels in L and v is the root vertex r, the algorithm returns it as an optimal solution (line 9).Otherwise, T(v, X, t) is pushed into D (line 10).
Next, the algorithm performs the path-growth operation (lines 11-14).If T(v, X, t) and P v,t contain all labels in L and they only have one common vertex v, then the expanded state s p is generated.As s p is a feasible solution according to Lemma 11, it is used to update Q and UB.Otherwise, if T(v, X, t) and P v,t contain multiple common vertices, UB is updated according to Lemma 12 (lines 15 and 16).
Ten, the algorithm attempts to perform the edgegrowth operation for T(v, X, t) (lines [17][18][19][20].For each in-edge e of v, if the arrival time of e is not larger than t, the path time constraint is satisfed.Ten, s g is used to update Q and UB. Finally, the algorithm performs the tree-merger operation for T(v, X, t) and the states in D (lines [22][23][24][25].If there exists a state T(v, X ′ , t ′ ) in D with the same root vertex v and X ′ ⊆ L\X, the expanded state s m is generated, which is used to update Q and UB.
We update Q and UB by using the update procedure with the expanded state (v, X, t) and its weight cost.In particular, if we merge (v, X, t) and its state path P v,t into a new tree with a weight value is equal to cost + W(P v,t ).If the weight value of the tree is larger than the current upper bound, the solution is not an optimal solution.Tus, the expanded state can be pruned and need not be pushed into Q for further expansion (line 27).
Next, if v is the root vertex r and X contains all labels in L, the expanded state may be a feasible solution.Ten, UB is set as the smaller value betweeb UB and the weight value cost (line 29).Ten, we push the expanded state and its cost value into Q (line 30).According to Lemma 13, in line 32, if there exists a state T(v, X, t′) in D that is better than the expanded state, (v, X, t), the expanded state can be pruned.Similarly, if there exists a better state (v, X, t ′ ) in Q, the expanded state can also be pruned.Else, if there exists a worse state (v, X, t ′ ) in Q, the worse state must be removed from Q.After that, the expanded state and its cost value are pushed into Q for further expansion (line 33).
Te framework diagram of DP is shown in Figure 3.
As Q is nonempty, top state After some state expansions, the states in Q are shown in Figure 4(d).For simplicity, we only considered the top three states in Q. Ten, s 9 = T(5, a, b { }, 4) pops from Q, the state path of which is denoted as P 5,4 = 〈e 2 , e 8 〉.Ten, s 10 = P 5,4 ⊕ s 9 = (0, a, b, c, d { }, 1) that is pushed into Q.After some state expansions, the algorithm pops s 10 from Q and returns it as an optimal solution.
In the following text, we illustrate that the path-growth corresponds to the combination of the edge-growth and tree-merger.Consider state s 9 .According to the tree-merger operation, we obtain state s 11 = s 9 ⊕ s 7 = (5, a, b, c { }, 4), where  b, c, d { }, 1).Clearly, s 15 is the same as s 10 , generated using the path-growth operation on s 9 .Tat is, the path-growth operation corresponds to two edge-growth operations and two tree-merger operations.

Algorithm Complexity.
Consider the algorithm time complexity in the worst case.Te main cost includes the queue operation cost as well as the costs of the edge-growth and treemerger operations.In addition, consider query label set L, where k = |L|.Ten, there exist 2 k subsets for L. For a state rooted at v ∈ V, there exist at most |E o (v)| diferent starting times.Furthermore, there exist at most states, where m = |E|.Ten, according to the Fibonacci Heap, the total cost for the queue operations is calculated as In the update, we must scan all states in Q and D to check whether a state is a bad state.In lines 17-20 (i.e., edge-growth), the total number of possible u ∈ V is bounded by O(|E i (v)|), where e = (u, v).Te total number of comparisons in line 18 is bounded by | and n = |V|, respectively.In lines 22-25 (i.e., tree-merger), we must scan all states in Q and D, and the total cost is similar to that of the update procedure.Tus, the time complexity is formulated as

Further Enhancement.
To design the A * -search algorithm DP+ for our problem, we must establish an efective lower bound for each state (v, X, t) in the search space [25,26].According to the A * search theory [25,26], the lower bound denotes the bound from the current state (v, X, t) to its goal state (r, L, t ′ ), where t ′ ≤ t.If (v, X, t) is removed from (r, L, t ′ ), let H denote the remaining tree, such that H = (r, L, t ′ ) − (v, X, t).Evidently, H is rooted at r and covers all labels in X = L\X.Ten, we must design a lower bound for the weight of tree H.In the following, we propose two efective lower bounds by using the state path and relaxing the set of covered labels.
For any state (v, X, t), we defne the path-based lower bound as ξ 1 (v, X, t) ≜ W(P v,t ), where P v,t is the state path of (v, X, t).Te following lemma shows that ξ 1 (v, X, t) is indeed a valid lower bound.Lemma 14.For any state (v, X, t), ξ 1 (v, X, t) ≤ W(H).
Proof.As the goal state (r, L, t ′ ) denotes the union of (v, X, t) and tree H, namely, H = (r, L, t ′ ) − (v, X, t), H contains the paths from r to v.As state path P v,t of (v, X, t) is a path from r to v, W(P v,t ) ≤ W(H).
For any state (v, X, t), tree H covers all the labels in X. Ten, we develop the label-based lower bound ξ 2 (v, X, t) by relaxing the constraint.Specifcally, we consider state (r, x { }, t ′ ), which corresponds to the tree rooted at r and covering only one label x ∈ X, where t ′ ≤ t.Ten, we defne the label-based lower bound to be the weight of the maximum weight tree over all T(r, x Te following lemma shows that ξ 2 (v, X, t) is also a valid lower bound.□ Lemma 15.For any state (v, X, t), ξ 2 (v, X, t) ≤ W(H).
Proof.For any state (v, X, t), T(r, x { }, t ′ ) corresponds to the tree with the minimum weight among all trees rooted at r and covering label x.Consider path P with the minimum weight among all paths from r to vertex v covering label x.In addition, suppose that the starting time of P is t ′ , such that S(P) = t ′ .Ten, P is contained in T(r, x { }, t ′ ).Next, we prove that T(r, x { }, t ′ ) corresponds to the path P. Without loss of generality, assume that there exists such an edge e that is contained in T(r, x { }, t ′ ) but not in P. Ten, W(T(r, x { }, t ′ )) ≥ W(P) + w(e) > W(P).P is also a tree that is rooted at r and covers the label x.Moreover, W(P) < W(T(r, x { }, t ′ )), this contradicts the defnition of T(r, x { }, t ′ ).Tus, the assumption does not hold.
As T(r, x { }, t ′ ) corresponds to the path P from r to v covering the label x ∈ X, the tree H contains all paths from r to the vertices that cover the labels in X. Ten, W(P) ≤ W(H).
According to Lemmas 14 and 15, we have the following lemma.

DP+ Algorithm.
Te DP+ algorithm description is in Algorithm 1, which is similar to that of the DP algorithm.Te framework diagram of DP+ and DP is similar.
Te main diferences between the DP and DP+ algorithms are as follows.First, the DP+ algorithm adopts the sum of the weight and the lower bound as the priority, whereas the DP algorithm only uses the weight as the priority.Each state is associated with an additional priority value, lb.Note that the states in Q are sorted according to their priority values in the ascending order.
Second, in the update procedure, the DP+ algorithm must call the priority function (line 12) to compute the lower bound and the priority of the expanded state and then determine whether the state can be pruned or not (line 14).Note that for a state, the priority value is often not less than the cost value.Tus, the pruning becomes tighter compared with the DP algorithm.
Note that in line 13, for each expanded state, the algorithm must take the maximum over priorities lb and  lb of its parent state to ensure consistency of the lower bound.Ten, the correctness of the algorithm can be guaranteed, which is analyzed as follows.

Algorithm Analysis.
According to the A * search theory, the developed lower bounds must satisfy the consistent property for the state-expansion operations.As the path-growth operation implies the combination of edgegrowth and tree-merger operations, we only need to consider the consistent property for each operation.
For a state (v, X, t), we frst prove that the path-based lower bound ξ 1 (v, X, t) is consistent, as shown in the following Lemma 17.In particular, for the state s = T(v, X, t), we can obtain a successor state s g = (s(e), X, t s (e)) by the edge-growth operation, where e ∈ E i (v) and t a (e) ≤ t.Similarly, by using the tree-merger operation to merge s = T(v, X, t) with s ′ = T(v, X, t ′ ), we can obtain a successor state s m = (v, X ∪ X ′ , min t, t ′  ).
Proof.Let P v,t , P g , and P m denote the state paths of states s, s g , and s m , respectively.
(1) Since s g = (s(e), X, t s (e)), P g corresponds to the path from root r to vertex s(e).By combining P g and edge e, we can obtain path P from r to v, and the arrival time of P is t a (e) ≤ t.Tus, P ∈ P(v, t) and W(P) = W(P g ) + w(e).As P v,t has the minimum weight value among all paths in P(v, t), W(P) ≥ W(P v,t ).In addition, as ξ 1 (s) = W(P v,t ) and ξ 1 (s g ) = W(P g ), ξ 1 (s g ) + w(e) ≥ ξ 1 (s).Terefore, this case holds.(2) As s m = (v, X ∪ X ′ , min t, t ′  ) and s = T(v, X, t), we have W(P m ) ≥ W(P v,t ) according to Defnition 9. Further, as ξ 1 (s m ) = W(P m ) and ξ 1 (s) = W(P v,t ), we have

International Journal of Intelligent Systems
However, the label-based lower bound is not consistent.Terefore, the following process is used to ensure consistency of the lower bound, as done in [27].
Specifcally, for the successor state s g of s = T(v, X, t) that is obtained by expanding an edge e ∈ E i (v), we set the new label-based lower bound ξ 2 ′ (s g ) = max ξ 2 (s g ),  ξ 2 ′ (s) − w(e)}.Similarly, for the successor state s m that is obtained by merging with s = T(v, X, t) and s ′ = T(v, X ′ , t ′ ), we set the new label-based lower bound ξ 2 ′ (s m ) = max ξ 2 (s m ),  ξ 2 ′ (s) − W(s ′ )}.Next, we prove that the new label-based lower bound is consistent.□ Lemma 18.For any state (v, X, t), we have (1) ξ 2 ′ (s g ) + w(e) ≥ ξ 2 ′ (s) and ( 2 Te consistent property also implies that the new labelbased lower bound is a valid lower bound [28].Based on the abovementioned lemmas, the consistent property can be preserved by taking the maximum operation over the devised consistent lower bounds (i.e., line 12 in Algorithm 1).Tus, the DP+ algorithm can fnd the optimal solution according to the consistency-guarantee property of the A * search.□ 3.5.2.Algorithm Example 2. Consider Figure 1(a).Similar to Algorithm example 1, in this example, queue Q was initialized with six states, as shown in Figure 5(a).Te difference is that here, we must compute the priority values for the initial states.For example, for the state (1, a { }, As the priority values of these states are larger than that of upper bound UB, the states are pruned in the DP+ algorithm, as shown in Figures 5(b) and 5(c).Note that s 2 and s 5 are not pruned in the DP algorithm.In addition, state (7, d { }, ∞) does not need to be expanded, as shown in Figure 5. Tis is because their priority values are the largest among the states in Q.

Unspecifed Tree Root.
Our extension problem can be formulated as follows.Given a temporal graph G = (V, E), a set of query label L ⊆ L, and a time constraint [t α , t β ].Te objective of our extension problem is to fnd a minimum weight tree T from G that is satisfed with [t α , t β ] and contains all labels in L.
By the modifcation of the DP algorithm, we present the algorithm called DP-UR for our extension problem.Te modifcation is given as follows.
(i) As the tree root is unspecifed, we cannot obtain the earliest arrival time for each vertex.Tus, Step 2 must be removed from the graph simplifcation.
In addition, the path-growth operation cannot be used.Tis is because for any state (v, X, t), we must obtain the path from a given tree root to vertex v. Tus, in the DP-UR algorithm, we expand the states by using the edge-growth and treemerger operations.
Input: G = (V, E), root r, time interval [t α , t β ], and the query label set L. Output: Te optimal solution.
(1) obtain G s = (V s , E s ), UB, Q and D by the way similar to DP (i.e., lines 1-3); (2) for each v ∈ V s and each 10 International Journal of Intelligent Systems (ii) Our extension problem does not require that the optimal solution contains a specifc root.Tus, we randomly selected a vertex v in V as the tree root to set the upper bound.Let UB be the sum of the weights of the distinct edges contained in the minimum weight paths from v to each vertex covering the labels in L. As the optimal solution has the minimum weight among all trees covering all labels in L, UB is not smaller than the weight of the optimal solution.Tus, we can set UB as the upper bound that can be obtained in a similar manner as the DP algorithm.(iii) Unlike the DP algorithm, if there exists a minimum weight tree that is satisfed with the time constraint and contains all labels in L, DP-UR halts operation and returns this tree as the optimal solution.
Terefore, we can say that the framework of DP-UR is similar to that of DP except for the aforementioned modifcation.

Progressive Search Algorithm.
Te progressive search algorithm works in rounds, reporting a suboptimal and feasible solution with smaller error guarantees in each round, until the last round outputs the optimal solution.In particular, we propose a new approach to construct a feasible solution for each state in each round and then produce progressively refned feasible solutions during algorithm execution.
Consider the DP+ algorithm.For each state (v, X, t) that is popped from Q, we can construct a feasible solution, T(r, L,  t), as follows.( 1) T(r,  X,  t) is obtained by performing the tree-merger operation on T(v, X, t) and its state path P v,t , where  X = X ∪ ψ(P v,t ).(2) According to the label-based lower bound, we easily obtain such a state T(r, x { }, t ′ ) that covers only one label x ∈  X ′ ( = L\  X).We repeatedly combine with T(r, x { }, t ′ ) until each label in  X ′ is included and then obtain a feasible solution T(r, L,  t).Tus, for any state (v, X, t), we can always report a feasible solution T(r, L,  t) and its approximation ratio, namely W(T(r, L,  t))/ W(T(v, X, t)).
In particular, we can obtain the progressive search algorithm by inserting the following description between lines 9 and 10 of the DP+ algorithm.
report the approximation ratio AR;

Top-N Search Algorithm.
Te top-N search algorithm aims to fnd the optimal GST ranked according to the weight of each tree, that is, the weight sum of the edges in each tree.In particular, we can obtain the top-N search algorithm by simply replacing line 8 of the DP+ algorithm with Here, i is initialized as 0. Te algorithm reports approximate answers for the top-N search, where N > 1; however, the frst answer, T 1 , is guaranteed to be optimal.Moreover, owing to the fact that the smallest cost tree is always placed at the top of the priority queue Q, we can fnd T 1 , T 2 , . .., T N in the increasing order of cost, i.e., W(T 1 ) ≤ W(T 2 ) ≤ . . .≤ W(T N ).Terefore, sorting is not required.In practice, the value of UB may be smaller than International Journal of Intelligent Systems that of W(T i ), and T i may be pruned.For simplicity, we removed the upper bound UB from the search algorithm.

Experiment
Tis section presents the performance evaluation of our proposed algorithms, including the algorithm running time and memory consumption.In addition, we show the effectiveness of the algorithms according to a case study.We executed all experiments on a machine with a 3.6-GHz Intel Core i7-9700K CPU and 32 GB RAM running Ubuntu 18.04 LTS Linux OS.All algorithms were implemented in C++.We compared our proposed algorithms with the baseline algorithm that is based on the algorithm in [18].

Experimental Settings
5.1.1.Datasets.We use fve real-world datasets, namely Austin, Houston, Los Angeles (LA) (https://code.google.com/p/googletransitdatafeed/wiki/PublicFeeds), IMDB (https://www.imdb.com/interfaces/),and DBLP (https:// www.cs.cmu.edu/~enron/)datasets.Austin, Houston, and LA datasets record the timetable of the public transportation networks of a major city on a weekday, which are also widely used in the path querying in temporal networks [2].Each vertex corresponds to the station, and each edge from a vertex to another represents a bus travel from one station to another.Te starting time and arrival time of the edge are the starting time and the arrival time of the route.We use the OpenStreetMap (https://www.openstreetmap.org/)to extract the POIs within 500 meters of each station.Te type of each POI is used as the label associated with the station.For the IMDB temporal graph, each vertex corresponds to a person such as the principal cast or director, a title, and the edges denote the diferent relationships among them.Teir names are used as the labels.Te starting time and arrival time of the edges are set as the release year of a title or TV Series end year.We assign weights to the edges based on the weight cascade model which is similar to [3].Te details for the corresponding temporal graphs for algorithm performance are given in Table 1.

Compared Approaches.
To evaluate the efectiveness, we compare the baseline algorithm BL with our two algorithms, DP and DP+, where DP is Algorithm 1 in Section 3.3, and DP+ is Algorithm 2 in Section 3.5.Tere are four important pruning techniques in our algorithms.To evaluate the efectiveness of the pruning techniques, we compare UB, P 1 , P 2 , and A * .UB means the case that we remove the state pruning P 1 and P 2 from the DP algorithm, P 1 means the case that we remove P 2 from the DP algorithm (i.e., UB + P 1 ), P 2 corresponds to the case UB + P 1 + P 2 , and A * corresponds to the case UB + P 1 + P 2 + A * .We also use algorithm BL-UR and algorithm DP-UR to evaluate the efectiveness of the extension problem which does not contain a specifed tree root.
(1) Baseline Algorithm.is the state-of-the-art algorithm for our problem, which is set as follows.
Te basic idea of the baseline algorithm call BL is to transfer the given timetable graph into a directed weighted (static) graph and then execute the existing algorithm for the GSTsearch on the static graph to fnd the optimal tree rooted at the specifed vertex r.Specifcally, BL functions as follows.First, timetable graph G = (V, E) is transformed into a directed static graph G(V, E) by using the graph transformation method proposed in [3], which requires only O(|E|) amount of time.In the graph transformation, the number of virtual vertices and virtual edges to be created for each nonroot vertex v ∈ V is based on the number of distinct arrival times of each in-edge for v.In particular, root r corresponds to one virtual vertex.Next, to solve our problem, we considered the algorithm proposed in [18], which is the best-known exact algorithm for keyword search in a relational database [17].We processed it on G to fnd the tree rooted at the virtual vertex of r, which has the minimum weight and covers all labels in L. After transforming, the number of vertex and edges in a directed static graph G(V, E) changes, |V| = m + n, |E| = 2m.Note that the algorithm in [18] possesses exponential time complexity.When the graph or query label set is relatively large, the baseline algorithm becomes impractical.Although the algorithm in [20] is more efcient, it is targeted at undirected graphs and thus cannot be applied to our problem, which comprises a directed graph.Te algorithm complexity of baseline is where k is the number of specifed labels, and m and n are the number of edges and vertices of the temporal graph, respectively.

Comparative Experiment Setting.
We vary two parameters in our experiments, namely kn and lf, where kn is the number of labels in the given query label L (i.e., kn = |L|) and lf is the average number of vertices covering each label in the query (i.e., the label frequency).Te value of kn is selected from 4, 5, 6, 7, and 8 with a default value of 4, and the value of lf is selected from 100, 200, 400, 600, and 800 with a default value of 400.Unless otherwise specifed, when varying a parameter, the values of the other parameters are set to their default values.Te time interval setting of all experiments corresponds to [0, ∞].In each test, we generate 30 queries and each query contains kn labels, which are randomly selected from the given set of labels, and the average results over all of them are reported.We set the query time-out value as 5 hours, i.e., 18,000 (18K) seconds.When a query time-out occurs, the query algorithm will be halted.For the root vertex in each temporal graph, we require that it can reach all other vertices of the selected 12 International Journal of Intelligent Systems connected components.We simply scan the vertices until one such vertex is found.Te details for the connected components are given in Table 1.In particular, the Enron dataset is used for the case study since the size of its connected components is relatively small.

Experimental Results and Analyses
5.2.1.Efect of kn on Running Time.As shown in Figure 6, the running time is increased with the increase of kn.Tis is because the increase of kn will result in the increase of algorithm search space.Te running time of our algorithm DP (DP+) is obviously smaller than that of BL.In particular, as shown in Figure 6(a), for kn = 8, the baseline algorithm BL algorithm requires 3,707 seconds, but our proposed algorithms DP and DP+ only take 0.42 and 0.24 seconds, respectively.Our algorithm DP+ is more than 15,446 times faster than BL.Tis is because the proposed graph simplifcation can result in a smaller graph for our algorithm.Meanwhile, more states can be pruned by the proposed optimization techniques.Besides, the lower bounds based on A * strategy can further reduce the number of states to be generated, and the running time of DP+ is obviously smaller than DP.As shown in Figure 6(b), if kn = 5, the baseline algorithm BL takes more than 3,636 seconds, and both DP and DP+ take 0.43 and 0.3 seconds, respectively.When kn = 6, 7, 8, the baseline algorithm BL is time-out and cannot be fnished in the specifed 5 hours, i.e., 18K seconds.However, for the case of kn = 8, the DP and DP+ only require 2.8 and 1.43 seconds, respectively.As shown in Figure 6(c), if kn = 6, 7, 8, the baseline algorithm BL is time-out.Both DP and DP+ take less than 10 seconds.As shown in Figure 6(d), if kn = 5, 6, 7, 8, the baseline algorithm BL is time-out.For kn = 8, DP and DP+ take about 771.8 seconds and 134.2 seconds, respectively.As we discussed above, kn has an important on the algorithm time complexity of BL, DP, and DP+.As shown in Figure 6, the time of the algorithm increases rapidly as kn increases.For BL, it transformed the temporal graph into a directed static graph frst.Te number of vertex and edge in the directed static graph is much larger than that in the temporal graph.Terefore, the time increase of BL is signifcantly faster than that of DP and DP+.However, BL does not contain any graph simplifcation and state pruning techniques.So, BL is much slower than DP and DP+.For DP, it adopts the proposed graph simplifcation and state pruning techniques.Terefore, DP is much faster than BL.For DP+, it uses A * search strategy to further up DP.So, DP+ can fnd the optimal solution faster.

Efect of lf on Running Time.
As shown in Figure 7, the running time is decreased with the increase of lf.With the increase of lf, there are more vertices containing the query labels.Ten, it is faster for the algorithm to achieve the optimal solution.In general, the running time of DP (DP+) is obviously smaller than BL.Tis is because we can obtain a simplifed graph by the graph simplifcation and at the same time the proposed optimization techniques can reduce the number of states in the algorithm.In particular, for lf = 100, in Figure 7(d), DP+ takes 0.66 seconds, and BL needs more than 3,116 seconds.DP+ is 4,721 times more faster than BL.As shown in other fgures, DP and DP+ can obtain the optimal solution in 1 second in most cases.Since the A * search strategy can further reduce the number of states, the running time of DP+ is smaller than that of DP.
In order to get the optimal solution, each state needs to do the edge-growth operation and tree-merger operation.As lf grows, so does the number of initialized states.Ten, more states can be merged.However, it is faster for the algorithm to achieve the optimal solution, as shown in Figure 7.For BL, with the increase of lf, the time of BL increases.Figure 7 illustrates how the time of BL increases as f increases.For DP and DP+, they adopt the proposed graph simplifcation and state pruning techniques.Terefore, DP and DP+ are faster than BL.For DP+, it has more pruning techniques than DP.Terefore, DP+ is faster than DP and BL.

Efect of Pruning Techniques on Running Time.
Tere are four main pruning techniques in the DP and DP+ algorithms, namely the upper bound UB, the state pruning methods P 1 and P 2 , and the A * search.In Figure 8, UB means the case that we remove the state pruning P 1 and P 2 from the DP algorithm, P 1 means the case that we remove P 2 from the DP algorithm (i.e., UB + P 1 ), P 2 corresponds to the case UB + P 1 + P 2 , and A * corresponds to the case UB + P 1 + P 2 + A * .Te running time can be dramatically reduced since lots of states can be pruned by the proposed techniques.As shown in Figure 8(d), the running time is relatively smaller on IMDB compared with other datasets.Tis is because the upper bound is more efcient since the vertices containing the query labels are nearer to the root vertex.Besides, the height of the optimal solution found in IMDB is smaller than in other datasets.

Efect of Graph Simplifcation.
As shown in Figure 9, the gap between the given temporal graphs and their simplifed graphs is obvious.Tis is because lots of edges and vertices can be removed by the graph flter.For Austin, after graph simplifcation, the vertices are reduced by 4.2% and the edges are reduced by 55.5%.For Houston and Los Angeles, the vertices are reduced by 7.8% and 60%, and the edges are reduced by 73.1% and 27.6%, respectively.Since the connected components of Austin and Houston are more denser, more edges and fewer vertices can be removed, compared with LA and IMDB.

Efect of kn and lf on Memory Consumption.
We conducted the experiments on the connected components of Austin, and the results are shown in Figure 10.In general, the memory consumption is increased with the increase of kn.Tis is because there are more states that need to be stored as the kn becomes larger.Te maximization consumption is about 48.   14 International Journal of Intelligent Systems 1,500 MB.In general, our algorithm memory is at least 30 times smaller than BL.On the other hand, the memory consumption is decreased with the increase of lf.Tis is because, with the increase of lf, there are fewer states that need to be stored in the algorithms.Since the number of states in our algorithm is smaller, the memory consumption of DP (DP+) is at least 14 times smaller than BL.As we discussed above, kn has an important impact on the algorithm memory consumption of BL, DP, and DP+.As shown in Figure 10, the memory consumption of the algorithm increases rapidly as kn increases.For BL, it has the highest number of states for fnding the optimal solution.Terefore, the memory consumption of BL is signifcantly larger than that of DP and DP+.For DP and DP+, they adopt the proposed graph simplifcation and state pruning techniques.Terefore, DP and DP+ need less memory consumption than BL.For DP+, it uses A * search strategy to reduce the number of states.So, DP+ needs less memory consumption than DP+.
As lf grows, so does the number of initialized states.Ten, two states merge into a new state will be earlier.However, it is faster for the algorithm to achieve the optimal solution.Terefore, DP and DP+ need less memory consumption.For DP+, it has more pruning techniques than DP.Terefore, DP+ needs less memory consumption.
(1) Running Time for Unspecifed Root.Since the problem extension does not contain a specifed tree root, in the baseline algorithm BL-UR, we the graph transformation method in [4] to transfer the temporal graph into the directed weighted graph.Te results on the Austin datasets are shown in Figure 11.In general, the running time of DP-UR is smaller than that of BL-UR.Tis is because the graph simplifcation can reduce the sizes of the temporal graph and the proposed pruning techniques can reduce the number of states in the algorithm.Similar to the reasons mentioned above, the algorithm running time is increased with the increase of kn and is decreased with the increase of lf.
(2) Memory Consumption for Unspecifed Root.Te results on the Austin datasets are shown in Figure 12.In general, the memory consumption of DP-UR is smaller than that of BL-UR since there are fewer states in DP-UR.Similar to the reasons mentioned above, the algorithm memory is increased with the increase of kn and is decreased with the increase of lf.
(3) Efect of N on Running Time.We test top-N search algorithm to fnd the optimal N solutions of all datasets.We vary N from 1, 10, . . . to 50 while fxing k and f at the default values of DP+ and report our results in Figure 13.From Figure 13, as N increases, the running time of DP+ increases.
(4) Progressive Performance Testing.In this experiment, we test how well the reported feasible solutions are progressively improved during algorithm execution.We randomly select a query with k = 4,f = 400,N = 1 on Austin and report the approximation ratio AR in Figure 14.For each algorithm, we can see that the approximation ratio AR decreases with increasing running time.As can be seen, the UB algorithm results in a 4-approximation solution within 14.8 seconds and obtains the optimal solution taking around 23.6 seconds.Te A * algorithm results in a 3-approximation solution within 0.14 seconds and obtains the optimal solution taking around 0.17 seconds.Tese results demonstrate that the A * algorithm exhibits excellent progressive performance in practice, which further confrms our theoretical fndings.

Case Study.
Te case study is on the DBLP datasets.Each vertex corresponds to an author, or a paper, and the edges denote the diferent relationships among them such as the coauthor relationship.Teir names are used as the labels.Te starting time and arrival time of the edges are set as the paper's publication time.We assign weights to the edges based on the weight cascade model which is similar to [3].In detail, the search labels correspond to the author names, namely Jennifer Widom, Jiawei Han, Jian Pei, and Philip S. Yu.Te time interval setting is (1990, 2021).Te connected tree is given in Figure 15, which shows the relationship between the specifed authors and their papers during the specifed time.By the found connected tree, we can know the most infuenced paper "Clustering Association Rules" written by Jennifer Widom in 1997 is related to the other authors.Tis study is cited by the paper "Mining Frequent Patterns without Candidate Generation" by Jiawei Han and Jian Pei in 2000 and the paper "Mining Large Itemsets for Association Rules" by Philip S. Yu in 1998.Both of them are also the most infuenced papers of the related authors written in the given time.
In this study, we considered searching for a GST in a temporal graph; this concept difers from that of the MST search [3,9,29].In addition, our solution is a type of exact algorithm, unlike the approximation algorithm [3], and it difers from the exact solution discussed in [9], which is based on the integer programming algorithm.In [18], the problem of keyword search in a relational database was formulated as a GST problem in a directed graph.In [29], a time-varying neural network for solving the time-varying minimum spanning tree problem with constraints is proposed, which is diferent.In addition, in [17], the authors showed that the algorithm in [18] is the best-known exact algorithm for the keyword-search problem.However, the algorithm is impractical for a relatively large graph or label set.To overcome this shortcoming, some optimization techniques were proposed in the progressive algorithm [20] International Journal of Intelligent Systems 16 International Journal of Intelligent Systems to improve the search of GST in a static graph.However, these optimization techniques are targeted at an undirected graph and are therefore not suitable for our problem.In [30], the GST problem with node and edge weights was considered and an approximate algorithm is proposed using a DP approach.In [33], a query relaxation algorithm was proposed that solves the small or even empty result sets when performing query operations in temporal graph databases.However, the efcient managing of the time information is key for our solution, which has not been studied in previous algorithms [18,20,30,33,42,43].Moreover, these studies have not considered the case of a GST with a specifed tree root.
Te path querying with various settings in temporal networks was studied in [2,4,8,11,12,[44][45][46][47].Unlike these studies, our problem focuses on the search for GST in temporal graphs.As discussed earlier, our problem can also be used in the path route applications.In addition, our problem seeks to fnd the connected minimum-weighted tree in temporal graphs, which is unlike the subgraph mining in temporal networks [7,10,13,[48][49][50].In general, our algorithm considers the search based on labels/keywords in a large graph, a method that is similar to the keyword search in large graphs [51] and the keyword-aware route search [52].However, the graphs in [51,52] do not contain temporal information.
Te rumors or infection spread application in social network was studied in [5,6,[53][54][55].Te authors of [5,6] are based on the Steiner tree in a temporal graph.Te problem in [5] was to determine multiple Steiner trees in which the roots are not unspecifed and each vertex is activated.In [6], the authors focused on searching for a single Steiner tree in which some vertices may be not activated.Our proposed problem can also be used in the application of rumors or infection spreading.However, we considered the labels associated with the vertices and focused on the GST search with a specifed tree root in a temporal graph.Moreover, the solution in [5,6] is a type of approximation algorithm, which difers from our exact solution.Te authors in [53][54][55] did not consider the efect of time in social networks on the problem of rumor propagation, which difers from ours.
Te efcient web APIs recommendation was studied in [34][35][36][37][38][39][40][41].Tese works model the web APIs recommendation problem as a group Steiner tree search problem.Te authors in [34] build an APIs correlation graph and explore a data-driven APIs recommendation approach named WAR to assist developers in fnding compatible APIs.Qi et al. [35] improved the model proposed in [34] by introducing a weighting mechanism that improves recommendation accuracy.Te authors in [36] incorporate a multiagent technique with MGST to produce potentially compatible APIs compositions.Te authors in [37] frst model the compatibility-aware web API composition allocation problem into a minimal group Steiner tree search problem and then use the determinantal point processes technique to diversify the recommended several web API compositions.Te authors in [38] devise an efcient web APIs recommendation approach with privacy preservation by incorporating the LSH technique with the MGST searching algorithm.Te authors in [39] propose a keywords-driven web API group recommendation technology for sustainable software creation, which can output multiple desirable groups of web API lists instead of only one.Te authors in [40] propose a collaborative fltering API recommendation model.Te core idea of it is to achieve collaborative fltering by mining binary-API topics as an embedding layer between mashups and APIs.
Te authors in [41] frst construct a web APIs correlation graph and then propose a correlation graph-based approach for personalized and compatible web APIs recommendation in mobile APP development.However, these studies have not considered the time information in the temporal graph which is important for our problem.
Although several related studies have been conducted in this aspect, such as the incremental computation of dynamic graphs [56], processing of growing temporal graphs [57], temporal data management [58], trace spatial-temporal graph evolution [59], maximal D-truss search in dynamic directed graphs [60], and querying connected components in temporal graphs [61,62], these studies did not consider the TGST search problem.

Conclusion
In this paper, we propose an efcient dynamic programming algorithm called DP for the computation of GST in temporal graphs, i.e., TGST.We adopted some new optimization techniques, including graph simplifcation and state pruning, to reduce the algorithm search space by a signifcant amount.Moreover, we designed the A * -search algorithm called DP+ that can further speed up the algorithm search.We also propose an algorithm for our extension problem, namely the TGST with unspecifed root, the progressive search of TGST, and the top-N search of TGST.We conducted a series of experiments on real temporal networks, and the results verifed the efciency and efectiveness of our algorithms.In the future, we plan to consider further optimization techniques for our problem with diferent settings such as a distributed application environment.As we can see, the A * strategy has a very obvious efect on the DP+ algorithm, and in future work, we can continue to search for other A * strategy.In the future, this work can be further combined with practical problems to propose specifc algorithm-pruning strategies for specifc practical situations.International Journal of Intelligent Systems Chen, Yubao Liu, and Raymond Chi-Wing Wong provided guidance on the algorithm design and proposed revisions to the writing of the manuscript.All authors reviewed the manuscript.Yubao Liu contributed equally to the study.
E i (u) = e | a(e) = u, e ∈ E { }, and E o (u) = e | s(e) = u, e ∈ E { }.Te in-degree and out-degree of u are equal to |E i (u)| and |E o (u)|, respectively.
and the set of query labels is L = a, b, c, d { }.Ten, we obtain an optimal solution, T, as shown in Figure 1(b), the weight of which is denoted as W(T) = w(e 2 ) + w(e 7 ) + w(e 8 ) + w(e 13 ) = 4.