Research Article

A Minimum Defense Cost Calculation Method for Attack Defense Trees

Algorithm 1

Conversion of an ADTree into an A2DTree.
Input ADTree
Output A2DTree
(1)procedure ConverseToA2DTree (Node root)
(2) Children: = {children of root node};
(3) NewChildren = {};
(4)i: = 1;
(5) repeat
(6)  child: = i-th node in Children;
(7)  if child is an intermediate attack node and
(8)   has defensive child nodes
(9)  then
(10)   T1: = new attack node;
(11)   Child node relationship of T1: = Child
(12)   node relationship of child;
(13)   T1’s children: = child’s children;
(14)   T2: = new attack node;
(15)   T2 children’s operator: = AND;
(16)   Add child to T2’s children set;
(17)   Add T1 to T2’s children set;
(18)   call conversToA2DTree (T1);
(19)   Add T2 to Newchildren;
(20)   else
(21)    call ConverseToA2DTree (child);
(22)    Add child to Newchildren;
(23)   end if
(24)   i: = i+1;
(25) until i = the subnode number of Children + 1;
(26) Collection of child nodes:=NewChildren;
(27)end procedure
(28)NewRoot: = new root node;
(29)Add the ADTree root node to the NewRoot child;
(30)node collection;
(31)call ConverseToA2DTree (NewRoot);