Skip to main content
1 of 3
Optimizer
  • 26.6k
  • 7
  • 67
  • 144

#CJam, 92 bytes

This is based on a recursive flood fill explained here and can be golfed a lot!

q~:Q_&{:IQ3/S*Sca5*+:T;G,G*{:AT=1$={[WXZ5 4_~_)_)]Af+Tf=AT='#a+&,g{TA'#t:T;}*}*}%;aT\/,3<},p 

Requires the input in order of ABCDEFGH like:

[0 1 1 2 1 0 5 5 1] 

and output is the connected nodes:

[1 2 5] 

Full explanation to follow

Try it online here

Optimizer
  • 26.6k
  • 7
  • 67
  • 144