Fix distance algorithm and set initial graph scale smaller