added test file with fewer vertices and edges and improved algorithm