1. A method of identifying portions of a computer program comprising the steps of: (a) receiving from a user a computer program fragment including multiple program elements including at least one instruction controlling the operation of a processor in a controller; (b) abstracting the computer program fragment into a search graph capturing a logical hierarchy of program elements based at least in part on the at least one instruction program element of the computer program fragment; (c) matching the search graph against multiple corresponding target graphs capturing the logical hierarchy of program elements of different multiple portions of the computer program; (d) returning at least one of the multiple portions of the computer program having a target graph matching at least a portion of the search graph according to a predetermined matching condition, wherein the logical hierarchy is a control-flow of the program elements describing the flow of program control among program elements and wherein the matching condition is a match of control-flow, and wherein the logical hierarchy is a data-flow of the program elements describing the flow of data among program elements.