When UseScalarWeights is enabled, the cost is calculated by dividing the distance by the squared scalar weight:

https://gitlab.kitware.com/vtk/vtk/blob/master/Filters/Modeling/vtkDijkstraGraphGeodesicPath.cxx#L165-169

cost = distance/(scalar*scalar)

Does anyone know why this equation is used instead of adding, or multipying/dividing by the scalar without squaring? My first though is that it’s to ensure that the sign is always positive, but then the following would work as well:

cost = distance/abs(scalar)