Input: DSDG, DR

Output: CDS

1:

function DSComposition(DSDG, DR)

2:

 fields ← DR

3:

for each field in fields do

4:

  ADSs ← ADS related to field

5:

end for

6:

 InitQueue(queue)

7:

  EnQueue(queue, ADS 0)     ▷The first ADS of ADSs

8:

while!QueueEmpty(queue) do

9:

  ADS i ← DeQueue(queue)

10:

  adj_ADSs ← DSDG  ▷Find all adjacent ADSs of ADS i

11:

   for each ADS in adj_ADSs do

12:

    ifADS haven’t been visited then

13:

    EnQueue(queue, ADS)

14:

    pre_ADSs ← ADS i is the prior node of ADS

15:

     if all ADSs have been visited then

16:

     break;

17:

     end if

18:

    end if

19:

   end for

20:

end while

21:

for j = 1 → the size of ADSs do

22:

  cur_ADS ← ADS j

23:

  pre_ADS ← pre_ADSs(cur_ADS)     ▷Get the prior node of cur ADS

24:

   while cur ADS is not ADS 1 do

25:

    if CDS dosen’t contain cur_ADS then

26:

    Add cur_ADS into CDS;

27:

    else

28:

    break

29:

    end if

30:

   cur ADS ← pre ADS

31:

   pre ADS ← pre ADSs(cur ADS)

32:

   end while

33:

end for

34:

return CDS

35:

end function

or Create an Account

Close Modal
Close Modal