1. A method comprising: receiving strokes representing a handwritten equation; for each stroke, a processing unit forming path scores for a combination of a symbol-relation pair that represents a symbol in a particular relation to a predecessor symbol and a predecessor symbol-relation pair that represents the predecessor symbol in a particular relation to a further predecessor symbol, wherein forming path scores comprises forming a plurality of path scores for the combination of the symbol-relation pair and the predecessor symbol-relation pair, each path score being associated with a different number of strokes being assigned to the symbol in the symbol-relation pair and selecting a best path score from the plurality of path scores; using the path scores to construct a symbol graph comprising nodes connected by path segments, each path segment having a path segment score that is based in part on a path score and representing at least a symbol-relation pair; using the symbol graph to identify a recognized mathematical expression that represent the handwritten equation; and storing the recognized mathematical expression.