0
$\begingroup$

I would like to analyze the distribution of the Customers from a Shop, if the Shop is closed or terminated. Consider the following sample data-set;

| ShopID | MonthlyCVisitCount |   Lat     |     Lng    |
--------------------------------------------------------
|  A1    |      15000         |  39.84349 |  116.33986 |
|  A2    |      24560         |  39.84441 |  116.33995 |  
|  A3    |      14789         |  39.84615 |  116.34012 |
|  A4    |      35479         |  39.84891 |  116.34039 | 

I would like to build a distribution model using NetworkX or iGraph based on the distance (i.e., lat, lng) and determine how the distribution (MonthlyCVisitCount) would spread if I supposedly close the shop A1.

Is it possible to obtain the shortest path from A1 to A2, A3, A4 and based on some business rules, I can analyze the distribution.

Edit 1:

Consider the modified dataset;

| PrimaryShopID | ToShopID |  Dist |
------------------------------------
|     A1        |    A2    | 0.125 |
|     A1        |    A3    | 0.354 |
|     A1        |    A4    | 0.950 |

The dataset above has distance between ShopID A1 to multiple shops, now that I have distance calculated and based on this distance I provide weights, say;

0 to 200 - 50%

201 to 500 - 20%

501 & above - 0%

Meaning that 30% of Customers I have lost.

How do I proceed with this scenario, I am mostly comfortable in working with R, any example or a pointer to the same problem will be helpful

$\endgroup$

1 Answer 1

0
$\begingroup$

NetworkX does have the ability to obtain shortest paths between points for you. As for how you can encode business rules, NetworkX does allow you to manipulate graph objects easily so you could code up a function containing your rules and apply it to to the graph object.

To model the distribution shift you could give weightings to each shop that would determine how much of the monthly visits they acquire when one of their neighbors close.

$\endgroup$
2
  • $\begingroup$ Thanks for the response, can you please elaborate a bit more, a example will also be helpful, I have modified the questions, please do have a look. $\endgroup$
    – James
    Mar 6, 2019 at 11:19
  • $\begingroup$ What in particular did you want me to elaborate? $\endgroup$
    – HFulcher
    Mar 6, 2019 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.