Research Article

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

Algorithm 1

Redundant statements preprocessing based on PDGs.
Input: The original code oc
Output: The target code tc
(1)Generate the PDG of oc: G(V, E, μ, δ);//convert oc to a PDG
(2)Denote the end node as G.ve, the target node set as V’; //V’ is the node set that are dependent on the last node
(3)for each  ∈ V, t = μ() do
(4)if (t = = return||t = = output) then//determine whether the current node t is a return statement or an output statement
(5)   = ;
(6)  break;
(7)end if
(8)end for
(9)V’ = DFS(V)//get node set that are dependent on the last node
(10)for each  ∈ G.V do
(11)if( ∉ V’) then//delete nodes that do not depend on the last node
(12)  tc = oc.delete()
(13)end if
(14)end for