Research Article

A Metric on the Space of Partly Reduced Phylogenetic Networks

Algorithm 3

Computing the -distance for and .
(1) input: networks and
(2) output: -distance
(3) for each pair of nodes and in do
(4)  decide semi-equivalence and equivalence for them
(5) end for
(6) for each pair of nodes and in do
(7)  decide semi-equivalence and equivalence for them
(8) end for
(9) for each pair of nodes in and in do
(10)  decide semi-equivalence and equivalence for them
(11) end for
(12) ;
() flag1 = false; flag2 = false
() for each node in do
()  for each node in do
()   if the IE of contains then
()    flag1 = true
()   end if
()  end for
()  if flag1 = false then
()   add to
()  end if
() end for
() for each node in do
()  for each node in do
()   if the IE of contains then
()    flag2 = true
()   end if
()  end for
()  if flag2 = false then
()   add to
()  end if
() end for
()  = 0
() for each node in do
()  
()  if then
()   
()  end if
() end for
() for each node in do
()  
()  if then
()   
()  end if
() end for
() return