I need to detect if there is a mismatch in the number of polylines that adjoin each other. For example one polyline in the middle, four either side (or it could be any number of mismatches: 3-2-3 for example. Polylines aren't snapped together; it's for a powerline project so it's not a requirement.
I can group the lines together and assign them grouped id's together using the attached process.
One final point; I only need to calculate the relationship of polylines that have 'neighbours' on either side and not on polylines with only one set of 'neighbours' (see below)