Research Article

Assembly Sequence Planning for Rectangular Modular Robots with Accessibility Constraints

Algorithm 5

AssemblyOrder (G, s) configurations with internal holes.
1: Label s as discovered
2: For each vertex w in G.adj[s] do
3:   If vertex w is labeled as undiscovered then
4:    Ifw can be added to the structure (addEdge (G, w) is true) then
5:     If s is a hole and w is not a hole or the first added robot system then
6:      If exists a discovered robot system z ∈ G.adj[w] then
7:       G.Tree[z] ← w
8:       G.parent(w) = s
9:      AssemblyOrder (G, w)
10:     Else
11:      G.Tree[s] ← w
12:      G.parent(w) = s
13:     AssemblyOrder (G, w)
14:    Else
15:     deleteBranch (G, s)
16:     Label s as undiscovered
17:     Return
18: If exists w in G.adj[s] marked as undiscovered then
19:   deleteBranch (G, s)
20:   If G.parent(s) is a hole, then
21:    If exists a discovered robot system z ∈ G.adj[w] then
22:     G.Tree[z] ← w
23:     G.parent(w) = s
24:    Return
25:   Else
26:    Label s as undiscovered
27:    Return