Distance Matrix Calculation with Groups

Hi,
I have two groups of stores, “small format” and “large format”. I need to calculate the distance between all stores to find the closest large format store to each small format store. I’ve successfully created a distance matrix, but because the output of the matrix is not all encompassing (i.e. if calc. dist. between A, B, C;A --> A =0, A–>B = 1, A --> C = 1.4, KNIME will not produce B --> A, C–> A, etc.), I’m not getting the correct results when ranking/filtering.

What’s the best way to split my data so that I can perform this calculation correctly?

forum_distance_example.knar (45.4 KB)

A quick example: The nearest large store to store # 2049 is store #212. However, the matrix says the closest store is #2094.


image

Thanks for your help!

Hi @Snowy, does this work?

I just made a branch after your column rename node, adding another rename node that swapped Cust_Num_1 and Cust_Num_2, then concatenated these new rows with the existing rows. So now there’s the full matrix (minus the 928 diagonal values which all have a distance of 0)

forum_distance_example.knar (53.6 KB)

Now, when I look up store #2049, the nearest large format store is #212:

matrix

3 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.