1. A computer implemented method for matching a pattern in a main netlist, the method comprising: (a) reading in the main netlist; (b) reading in a pattern for finding matches in the main netlist, wherein the main netlist and the pattern include a plurality of vertices, each of the vertices being a net or a device; (c) computing labels for each of the vertices in both the main netlist and the pattern up to a depth appropriate for the pattern; (d) matching a vertex of the pattern with one or more vertices of the main netlist using the computed labels; and (e) storing the computed labels for each of the vertices in the main netlist for possible reuse in subsequent pattern matches.