shortestPath: corrected shortestPath implementation, now assesses weight properly