Using iGraph to build a Distribution Model

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

Topic graphs data-mining machine-learning

Category Data Science


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.