1. A pattern shape evaluation method comprising causing a computer to perform operations of: acquiring an image of an evaluation target pattern including a plurality of element patterns; detecting an edge of the evaluation target pattern from the image; dividing the detected edge of the evaluation target pattern into a plurality of evaluation target pattern edge groups; acquiring an edge of a reference pattern serving as an evaluation standard for the element patterns; dividing the edge of the reference pattern into a plurality of reference pattern edge groups; selecting a reference pattern edge group to be aligned with the edge of the evaluation target pattern from the divided reference pattern edge groups; aligning the edge of the selected reference pattern edge group with the edge of the evaluation target pattern; evaluating the shape of the evaluation target pattern by use of the result of the alignment; carrying out a first alignment of the edges of all the divided reference pattern edge groups with the edges of all the divided evaluation target pattern edge groups; associating the edges of the reference pattern edge groups with the edges of the evaluation target pattern edge groups by use of the result of the first alignment; and calculating the amount of a positional difference between the edges of the reference pattern edge groups with the evaluation target pattern edge groups for each of the corresponding edge groups, wherein the reference pattern edge group is selected by excluding a reference pattern edge group of an element pattern that is more likely to decrease an accuracy in alignment between the evaluation target pattern and the reference pattern than other element patterns by use of the calculated amount of the positional difference and a preset threshold value, and the evaluation of the shape of the evaluation target pattern is carried out by use of the result of a realignment of the edge groups excluding the edge group in which the amount of the positional difference is relatively large.