Combinations problem: any quantity, variable outcomes

camhard

New member
Joined
May 2, 2018
Messages
1
I'm struggling to figure out a formula that identifies the number of unique ways a group of geometries can be selected so that they form a continuous whole.

In the example below, there are 6 geometries. A valid selection could be a group of anywhere between 1 and 6, so long as they are contiguous. E.g. [A,B] works, as does [F,A,B], however, [E,A] is not valid, nor is [D,B].

Similarly, order does not matter: [A,B] and [B,A] should only be counted once.
IMG_20180502_171845-01.jpg

My approach was to count the number of immediate neighbours that each geometry has, take the sum of these values, and subtract 1. This seems to hold true in a number of cases, but definitely not all.

Name
Neighbours
A3
B2
C2
D4
E2
F3

The example here, according to my calculation should be groupable in 287 distinct ways (3*2*2*4*2*3-1=287).

This formula does not work when there are geometries with only a single neighbour. 2 rectangles, rectangle A and rectangle B, side-by-side for example. The formula would yield 1*1-1=0, whereas they could be grouped as [A], , or [A,B], ie 3 possible groupings.

I've spent so much time with this, and searched all over. Maybe I'm just not using the right terms, but I can't figure it out.

Thanks!
 
Top