The algorithm was custom made to solve these specific graph puzzles. But clearly it isn't perfect yet ;P