Simon learned this from the SingingBanana channel:

In this video, Simon solves the famous Motorway Problem (or Steiner Problem) naturally, using soapy liquid. The problem is about four towns located in a one mile squared and looking for the shortest and most efficient way to connect them. Simon goes through the possibilities and then uses his homemade prop to find the shortest path to connect four points. Sometimes, the prop manages to show the local minimum instead of the solution, Simon explained, so make sure you get rid of the extra bubbles and pull the prop from the water vertically, not horizontally.

Simon also explains the physics behind the experiment: The trick works because a bubble minimises its tension.