We’ve weighted waypoints with our A* based on several factors:
Distance is the main one, then multiplied by the safety of the route.
But the ‘safety’ of a route varies depending on the craft’s purpose.
So, for a pirate or smugger, it will weight stealthier routers through dark but harmless nebulae over main shipping routes.
So, the distance through a nebula may be, say, 200Gms, and 120Gms via shipping, but a smuggler would ‘modify’ that nebula route by, say, 0.5, where-as a normal merchant may multiple it by 1.5 to make it less likely (unless it really is just easier to do so).
Same thing happens with dangerous things - asteroid fields, etc. Only when escaping torpedos will most ships dodge into an asteroid field.