[Paper Review] Nonrepetitive Paths and Cycles in Graphs with Application to Sudoku
This paper introduces a linear-time transformation that converts edge-labeled graphs into unlabeled graphs such that nonrepetitive paths—paths with no two consecutive edges sharing the same label—correspond exactly between the original and transformed graphs. The method enables efficient detection of nonrepetitive paths and cycles, with applications to Sudoku puzzle solving, where it identifies effective nonlocal solving rules that resolve 72.5% of puzzles otherwise unsolvable by local rules alone.
We provide a simple linear time transformation from a directed or undirected graph with labeled edges to an unlabeled digraph, such that paths in the input graph in which no two consecutive edges have the same label correspond to paths in the transformed graph and vice versa. Using this transformation, we provide efficient algorithms for finding paths and cycles with no two consecutive equal labels. We also consider related problems where the paths and cycles are required to be simple; we find efficient algorithms for the undirected case of these problems but show the directed case to be NP-complete. We apply our path and cycle finding algorithms in a program for generating and solving Sudoku puzzles, and show experimentally that they lead to effective puzzle-solving rules that may also be of interest to human Sudoku puzzle solvers.
Motivation & Objective
- To develop an efficient algorithmic framework for detecting nonrepetitive paths and cycles in edge-labeled graphs, where no two consecutive edges share the same label.
- To apply this framework to Sudoku puzzle solving, modeling human-like reasoning through nonlocal constraints.
- To identify and implement rule-based solving techniques that go beyond local elimination, improving puzzle-solving efficiency.
- To demonstrate the practical effectiveness of nonrepetitive path and cycle detection in real-world puzzle generation and solving.
Proposed method
- Construct a transformation from an edge-labeled graph G to an unlabeled directed graph nr(G), such that nonrepetitive paths in G correspond bijectively to paths in nr(G), with O(m) vertices and edges.
- Use strong connectivity analysis in nr(G) to identify edges in G that belong to nonrepetitive cycles, in linear time.
- Apply depth-first search in nr(G) to determine all edges reachable via nonrepetitive paths starting from a given vertex and label, in linear time.
- For undirected graphs, use linear-time algorithms to test existence of nonrepetitive simple paths between vertices and list edges in nonrepetitive simple cycles in O(m²) time.
- Show that for directed graphs, testing existence of nonrepetitive simple paths or cycles is NP-complete, establishing computational hardness.
- Model Sudoku puzzles as bipartite bivalue graphs with flag-labeled edges, and apply nonrepetitive path and cycle detection to derive nonlocal solving rules.
Experimental results
Research questions
- RQ1Can nonrepetitive paths and cycles in edge-labeled graphs be detected efficiently using a graph transformation?
- RQ2What is the computational complexity of finding nonrepetitive simple paths and cycles in directed vs. undirected graphs?
- RQ3How can nonrepetitive path and cycle detection be applied to derive effective, human-like solving rules for Sudoku puzzles?
- RQ4To what extent do nonrepetitive path-based rules improve the solvability of Sudoku puzzles beyond local constraint propagation?
Key findings
- The transformation from G to nr(G) preserves nonrepetitive paths and cycles and can be computed in linear time, assuming edge labels are grouped per vertex.
- Nonrepetitive cycles in undirected graphs can be detected in linear time using strong connectivity analysis in nr(G).
- Nonrepetitive simple paths in undirected graphs can be tested for existence between any two vertices in linear time.
- The problem of finding nonrepetitive simple paths in directed graphs is NP-complete, establishing a complexity boundary for the approach.
- In experimental evaluation, nonlocal rules based on nonrepetitive paths and cycles resolved 72.5% of puzzles that were otherwise unsolvable by local rules alone.
- The nonrepetitive cycle rule can be implemented in O(B⁴) time and the repetitive cycle and conflicting paths rules in O(B⁸) time for Sudoku puzzles of size B×B.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.