Algorithm 2.
check-node(node w, node q)
| 1: | result1 = compare(w, q) |
| 2: | ifresult1 = `inclusion' then |
| 3: | if ∃ extension-parents(q) then |
| 4: | for each p ∈ extension-parents (q) do |
| 5: | skip node if `visited' |
| 6: | result2 = check-node(w, extension-parent(q)) |
| 7: | ifresult2 = `extension' or `non-overlap' then |
| 8: | check-graph(w, inclusion-graph (q)) |
| 9: | if w cannot be placed in inclusion-graph(q) or ∄ inclusion-graph(q) |
| 10: | ⇒ add the inclusion of w in q |
| 11: | add extension to p if any |
| 12: | else if ∃ valid inclusion-graph(q) then |
| 13: | return check-graph(w, inclusion-graph(q)) |
| 14: | else |
| 15: | place inclusion here |
| 16: | else |
| 17: | returnresult1 |
| 18: | ifw placed then |
| 19: | return `placed' |
| 20: | else |
| 21: | returnresult1 |