There is a network of connected electric bulbs each with a unique id. Each bulb has a switch. When the switch is clicked, the colour of the bulb changes and also the colours of connected bulbs change. The order in which the colour-change occurs is green-yellow-red-green. The network of bulbs is a connected graph (but not necesarily a complete graph). I want to find a way by which I can convert all bulbs to green. This could be represnted by sequence of ids of bulbs whose switches can be clicked to get the final outcome.
I tried to solve this by converting the problem to a graph. Each node of the graph representing a state of the network so that two states are different if there is at least one unique bulb which has different colour in those two states. Then by using Dijkstra's shortest path algorithm I tried to find a path to the final state where all bulbs have green colour. (Although in my problem I don't need a shortest path. But this is also one valid solution.) This worked fine for small networks (number of nodes less than 12). But as the number of nodes increased the number of states increased so much that my program was running forever.