mehod looks through all vertices, but makes mistakes.