Waze tries to find the best route between you and your destination based on your navigation settings. Obviously it can only route based on roads that it knows about, so your route will not be optimal if a better route does not have all the roads with correct connections in the Waze Map Editor. Also if segments are less than 5 m (16 feet) they can cause routing issues.