I am going to estimate a Multinomial Logit model for the discrete choice analysis, in which user chooses a route among other available paths. This is intended to determine the utility of those paths. As these alternatives should be mutually exclusive, as per assumption of MNL model (IIA) this is not true. It is because some of the alternatives have common links between them. In order to correct this, path-size correction should be used, which is attached below (from previous studies).
I'm just wondering if there's any R/Python package to calculate this path-size factor between the alternatives before estimating the MNL model? If not, how can I formulate this in R/Python to calculate?