Made edge weight a reference based on a suggestion by Tristram Gräbener; made vertex distance variables const values