Where Will Java House Open the Next Branch

Let’s play a game – the game goes, where would you place the location pin for the next Java outlet in Nairobi? The restaurant chain has been on a rapid expansion in the past two years and there are no signs of stopping the momentum. This week, the company opened a new outlet at Shell Petrol Station in Parklands thereby increasing the density of their outlets in the Westlands region. It is worth noting that a new Java House outlet costs about Kshs 50 million to set up – therefore, the decision on location has to be well calculated. Let’s begin our quest by understanding the current dispersion of Java outlets in the city.

Locations of Java House restaurants in Nairobi

As anticipated, the density of outlets is highest in the Central Business District and most other outlets spread to the west of the city. Using the current restaurants as reference points, we can begin our task of predicting where the next outlet would be located. To get started, we will use an interesting mathematical algorithm known as a Voronoi Diagram. Given a set of geographical locations, the Voronoi partitioning algorithm finds optimal boundaries that define the sphere of influence of a location.

Example, when rival gangs operate in the same territory, given the ‘headquaters’ of each gang, then the Voronoi algorithm would define the optimal boundaries of the gangs essential minimise conflict. Thinking of each Java outlet as a gang that needs to control territory, then we can build a visualisation of their area of influence as shown below.

Voronoi diagram of Java outlets in Nairobi

We can already see that some outlets control very large areas whilst other are way too small. From a strategy point of view, it would be logical to find the largest territory and split it for the new outlet. However, the inverse presents the best strategy. If a territory was split before it means that’s an area where they have influence and more customers. The more it is split, the high the chance of success until a critical threshold is met where the outlets will be too many to be viable. A good example is Java Mama Ngina Street and Java City Hall which are less than 50 meters apart.

Back to our prediction problem. Now, we have another data point to use – sector. Initially, the first Java restaurant in Adam’s Arcade had only one sector – the whole of Nairobi. As more outlets were opened, the sector was split and from the other sub-sectors formed. Using the logic built in the previous paragraph, we can use conditional probability to measure the likelihood of a sector being split given it was formed from another split sector.

Conditional probability is used to model events that rely on pre-conditions. Example, what’s the probability that it would rain if the clouds are dark and it’s August? – Pretty high. The pre-conditions can be as many as observable variables (the more, the merrier – improves accuracy).

These can form a very large chain such as, what’s probability of someone winning a presidential election if they are an incumbent president, very rich, come from the largest tribe, studied abroad, is charismatic, likeable, has a powerful deputy et cetera. Using the same logic, we can build a chain of probabilities measuring the chance of a sector being split given it came from a sector that was split before which was in turn split before…. The diagram below shows a sample of the process evaluating the conditional dependency of sectors (locations)

Bayesian learning algorithm evaluating hierarchy paths

Finally, we visualise the dependencies using a bayesian network which creates connections that have the highest dependencies. In the network, if we track the path(s) with most nodes (locations), then we will find the sector that has the highest number of sub-divisions hence of great interest to Java. The diagram below shows the resultant Bayesian Network.

Bayesian Network of Java Locations

From the diagram, the first location with the highest probability of getting a new outlet is between Uniafric House (CBD) and TRM Mall. For this region, the best candidate locations are Mobil Plaza in Muthaiga and Ruaraka. Two other locations that scored highly were; between Aero Club (Langata) and Prestige Plaza, and between Embassy House (CBD) and Phoenix House (CBD) – along Uhuru Highway.


Cover photo by: Amy the Nurse


  1. obrahed

    Hi Orwa,

    Great and insightful post.

    I’m curious, can you do one on Big Square? I’ve noticed they have are also developing sites located at She’ll Service Stations. One is at Wilson and the other is on Mombasa Road.


  2. David

    Hi Orwa,
    Java recently opened at Rosslyn Riveria which from your statistics, you can say is probably between Uniafric and TRM, but out of the best candidates locations of Muthaiga and Ruaraka. Did that surprise you?

    1. blackorwa

      Hi David,

      Yes, this was a bit of a surprise. However, the are additional factors that determine where to locate an outlet. This includes if Java can negotiate good long term lease rates.

      That said, I think the new mall is still within a good margin of error where. The area bounced by Thika Road and Waiyaki way had most of their potential customers yet too few outlets.

Leave a Reply