Local algorithms for non-linear dimensionality reduction [1], [2], [3], [4], [5] and semi-supervised learning algorithms [6], [7] use spectral decomposition based on a nearest neighborhood graph. In the presence of shortcuts (union of two points whose distance measure along the submanifold is actually large), the resulting embbeding will be unsatisfactory. This paper proposes an algorithm to correct wrong graph connections based on the tangent subspace of the manifold at each point. This leads to the estimation of the proper and adaptive number of neighbors for each point in the dataset. Experiments show graph construction improvement.