Principal curves have been defined as self-consistent smooth curves that pass through the middle of data. One of the important problems with most existing principal curve algorithms is that they are seeking for a smooth curve. In reality, data may take complicated shapes, which may include loops, self-intersections, and and bifurcation points; hence, a smooth curve passing through the data may not be a good representor of the data. Generally, there is, in fact, a principal graph, a collection of smooth curves that represents the dataset. We propose a nonparametric principal graph algorithm, and apply it to optical character recognition, where handling the above mentioned irregularities like loops and self-intersections is a serious problem that appear in many characters.