# Connect the wires without setting off the bomb

You just saw a planted time bomb! Just 5 minutes are remaining until it explodes and as you are in currently in a rural area (no bomb disposal squad) and you know how bombs usually work it is up to you to decide it.
The interesting part of the circuit is below:

To defuse the bomb you have to connect each same-colored pair of nodes (circles) except the red ones. Short circuiting subject to the rules mentioned below or connecting two different colored nodes will set off the bomb.
The 4 master nodes (red) have to be connected such that you can start from any master node and go across wires and come back to the same node, without visiting any node except itself or any wire twice.
Unfortunately you didn't come prepared for this situation, so the only things you have that could be useful are some old wire and a scissor. As those wires are prone to short circuiting, no two wires can touch, and no wire can touch the circuit boundary. Also you are supposed to treat the circuit like it is 2D, as the wires are flimsy and couldn't hold a height. You cannot use the scissor for anything except cutting wires. Wires do not have to be straight and you cannot connect a wire to the middle of an another wire, all wires must start and end at nodes.
Can you save the day?

Abstraction:
In the diagram, connect the nodes with edges so that no two different color nodes are connected, same color node pairs are connected, the red nodes form a cycle, no edge touches the boundary and no two edges intersect.

This solution works:

(Places where the wires are close together can be pushed apart a bit - there aren't any crossed wires, though.)

My strategy:

The only sorts of topological restrictions involve lines where both ends must be connected to the edge of the grid. That's the only way to cut off any paths - in all other cases, you can just move wires around other wires as necessary. So there's an easy way to solve this puzzle: just do the red loop last, because it's the only thing that can cut off any future lines.

Nothing else cuts the grid into different regions, so as long as you do the red last it's impossible to not solve the puzzle!

• Wow, congratulations on solving it this quickly! :D
– user47134
Commented Sep 5, 2019 at 19:41