D.3.3 ALGORITHMS FOR INCREMENTAL ... - SecureChange
D.3.3 ALGORITHMS FOR INCREMENTAL ... - SecureChange
D.3.3 ALGORITHMS FOR INCREMENTAL ... - SecureChange
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
20 F. Massacci and L.M.S. Tran<br />
Algorithm 2. Updating incrementally DAT.<br />
1 procedure updateDAT(G : EvolutionaryHyperGraph, t : node)<br />
2 begin<br />
3 makeQemtpy();<br />
4 enqueue(Q, t);<br />
5 while Q ≠ ∅ do<br />
6 n ←dequeue(Q);<br />
7 i ←0;<br />
8 DAT[n] ←∅ ;<br />
9 for each 〈 x, n, p 〉 ∈G do {incoming edges of n}<br />
10 i ←i + 1; {i th incoming edges of n}<br />
11 if n is an observable node then<br />
12 DAT[n] ←concat(n, DAT[n], map(〈 x, i, p 〉, DAT[x]));<br />
13 else if n is a goal node then<br />
14 DAT[n] ←concat(n, DAT[n], DAT[x]);<br />
15 else<br />
16 DAT[n] ←join(n, DAT[n], DAT[x]);<br />
17 for each 〈 n, y, p 〉 ∈G do {outgoing edges of n}<br />
18 enqueue(Q, y);<br />
19 end<br />
The inputs of Algo. 2 are the evolutionary hypergraph whose nodes’ DAT have<br />
been generated by Algo. 1, and a changed node t. The algorithm initializes a queue<br />
Q holding nodes whose DATs need to be updated (line 3). At the beginning, Q holds<br />
t. Then, the while loop at line 5 sequentially extracts nodes n from Q to update<br />
DAT(n). Once node n extracted, its DAT is reset to empty, then the for loop at line<br />
9 re-calculate DAT[n] as exactly as Algo. 1 does. After that, the for loop at line<br />
17 puts all ancestors of n to Q to further update their DATs.<br />
Theorem 1 The algorithm 1 always terminates in time polynomial in the number<br />
of nodes of the hypegraph and the number of alternative solutions. When terminated,<br />
all DATs of all nodes in the input graph are initialized as Formula 9.<br />
Proof (Theorem 1) Let us consider the first point in the theorem about the polynomial<br />
complexity of the algorithm. Algo. 1 has two for loops (line 9, 17) nesting<br />
inside a while loop (line 4). The two for loops are proportional to the maximum<br />
incoming edges of an arbitrary node. Suppose that the graph has n node, then the<br />
maximum incoming edges is n − 1. Hence the complexity of these for loops are<br />
O(n) if we ignore the complexities of join and concat.<br />
The outside while loop terminates when the queue Q empty. At beginning,<br />
the initialization at line 3 pushes all leaf nodes to the queue. Later on, only nodes<br />
y which REACH[y] equals 0 are enqueued (line 19, 20). When a node y is being<br />
processed, its corresponding REACH[y] is marked as -1 (line 8). Thus every node<br />
is processed exactly once due to the check at line 7. Hence the complexity of the<br />
algorithm is O(n 2 ).