Research Article

Flow Chart Generation-Based Source Code Similarity Detection Using Process Mining

Algorithm 3

Graph edit distance of two CDFCs.
Input: CDFC1 = (V1, E1), CDFC2 = (V2, E2), where, V1 = {,..., } and V2 = {,..., }
Output: Minimum cost path λmin that CDFC1 is transformed to CDFC2
(1)OPEN ⟵ {Ø}, λmin ⟵ Ø;
(2)if is a subset of then
(3) = ;
(4)end if
(5)for each node  ∈ V2  do
(6)OPEN ⟵ OPEN ∪ { ⟶ };
(7)OPEN ⟵ OPEN ∪ { ⟶ ε}; //the operation and cost value of that replaces and deletes each vertex in CDFC2 are stored into OPEN
(8)end for
(9)while true do
(10)OPEN ⟵ ; //g(λ) is the accumulated distance value from the starting point to the current search point, h(λ) is the estimated distance value from the current point to the end point, and the point with the smallest function value is the next search point
(11)if λmin is a complete edit path then
(12)  return λmin;
(13)else
(14)  λmin = { ⟶ ,...,  ⟶ }
(15)  if k < |V1| then
(16)   for each  ∈ V2\{,...,}do//V2\{,...,} represents unmatched nodes in V2
(17)    OPEN ⟵ λmin ∪ { ⟶ };
(18)    OPEN ⟵ λmin ∪ { ⟶ ε};
(19)   end for
(20)  else
(21)   for each  ∈ V2\{,...,} do
(22)    OPEN ⟵ λmin ∪ {ε ⟶ };
(23)   end for
(24)  end if
(25)end if
(26)end while