Research Article
Dominance-Partitioned Subgraph Matching on Large RDF Graph
Algorithm 2
DPPG-construction algorithm.
| | Input: a pattern graph | | | Output: a dominance-partitioned pattern hypergraph | | (1) | i = 0, DFS[ur] = i, ⟵ ur; | | (2) | For u ∈ ur.successors do | | (3) | If u is unvisited then; | | (4) | DFS[u] = i++, Continue to ur.successors; | | (5) | Else if u is visited then | | (6) | ⟵ u; | | (7) | For DFS[u] = I from to 0 do | | (8) | For u′ ∈ u.precursors do | | (9) | If DFS[u] ∈ DFS[u′] then | | (10) | ⟵ (u, u′), Continue to u′.precursors; | | (11) | Else if sdom[u] > sdom[u′] then | | (12) | ⟵ (u, u′), sdom[u] = sdom[u′]; | | (13) | ⟵ |sdom[u], u); | | (14) | For u ∈ in descending order of DFS do | | (15) | For u′ ∈ − u do | | (16) | If DFS [u] < DFS [u′] < DFS [sdom[u]] then | | (17) | Removing u from ; | | (18) | For u ∈ do | | (19) | ⟵ (u, u.precursors), = ∪ ; | | (20) | For u ∈ and u′ ∈ − u do | | (21) | If ∧ ≠ ∅ then | | (22) | ⟵ (u, u′); | | (23) | Return; |
|