Skip to main content
. 2023 Feb 24;23(5):2551. doi: 10.3390/s23052551
Algorithm 1 Program dependency graph serialization algorithm PDG2Seq
 Input: G=(V,E), V={v1,v2,,vn}, E={e1,e2,,em}
 Output: Minimum graph serialization encoding seq={s1,s2,,sw}
1: initialization seq= (), i = 0; currentNode = v0;
2: for v in V do
3:   v.visted = −1;
4: end for
5: DFSSearch (G, currentNode, seq);
6: for e in E do
7:  Find the insertion position in seq according to the rule T,Insert the backtracking edge e into seq;
8: end for
9: return seq
10: Subprocedure 1 DFSSearch (G, currentNode, seq)
11:   currenINode.visited = i;
12:   for nei in currentNode.neighbors do
13:    array = ()
14:    for e in E do:
15:      if e.begin == currentNode then
16:        array.add (e)
17:       end if
18:    end for
19:    e = min (Sort (array));
20:    if q.visited == −1 then
21:      i + = 1;
22:      E.remove (e);
23:      seq.add (e);
24:      DFSearch (G,q, seq);
25:    end if
26:   end for