Preprint
Essay

This version is not peer-reviewed.

Polynomial-Time Algorithms for 0-1 Matrix Isomorphism, Graph Isomorphism and Latin Squares

Submitted:

15 March 2026

Posted:

17 March 2026

You are already at the latest version

Abstract
This paper presents a polynomial-time algorithm for 0-1 matrix isomorphism. Since 0-1 matrix isomorphism is equivalent to graph isomorphism, this algorithm can solve graph isomorphism in polynomial time with a time complexity of O(n4).I also prove that counting the number of mappings between two graphs is a #P-complete problem. In addition, this paper proposes a general algorithm for rapidly generating all N × N Latin squares, together with its precise counting framework, a polynomial-time algorithm for (quasigroup) isomorphism, and a method for the polynomial-time reduction of Latin square isomorphism to 0-1 matrix isomorphism. Efficient algorithms for solving Latin square filling problems are also introduced. Numerous combinatorial isomorphism problems, including Steiner triple systems, Mendelsohn triple systems, 1-factorization, networks, affine planes, and projective planes, can be reduced to Latin square isomorphism. Since groups are proper subsets of quasigroups and group isomorphism is a subproblem of quasigroup isomorphism, group isomorphism naturally becomes a P-problem. A Latin square of order N is an N×N matrix where each row and column contain exactly N distinct symbols, with each symbol appearing only once. A matrix derived from such a multiplication table forms an N-order Latin square. In contrast, a binary operation derived from an N-order Latin square as a multiplication table constitutes a pseudogroup over the Q set. I discovered four new algebraic structures that remain invariant under permutation of rows and columns, known as quadrilateral squares. All N×N Latin squares can be constructed using three or all four of these quadrilateral squares. Leveraging the algebraic properties of quadrilateral squares that remain unchanged by permutation, we designed an algorithm to generate all N×N Latin squares without repetition when permuted, resulting in the first universal and nonrepetitive algorithm for Latin square generation. Building on this, we established a precise counting framework for Latin squares. The generation algorithm further reveals deeper structural aspects of Latin squares (pseudogroups). Through studying these structures, we derived a crucial theorem: two Latin squares are isomorphic if their subline modularity structures are identical.Based on this important and key theorem, and combined with other structural connections discussed in this paper, a polynomial-time algorithm for Latin square isomorphism has been successfully designed. This algorithm can also be directly applied to solving quasigroup isomorphism, with a time complexity of 5/16(n5 − 2n4 − n3 + 2n2) + 2n3 Furthermore, more symmetrical properties of Latin squares (pseudogroups) were uncovered. The problem of filling a Latin grid is a classic NP-complete problem. Solving a fillable Latin grid can be viewed as generating grids that satisfy constraints. By leveraging the connections between parametric group algebra structures revealed in this paper, we have designed a fast and accurate algorithm for solving fillable Latin grids. I believe the ultimate solution to NP- complete problems lies within these connections between parametric group algebra structures, as they directly affect both the speed of solving fillable Latin grids and the derivation of precise counting formulas for Latin grids.
Keywords: 
;  ;  ;  
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings

© 2026 MDPI (Basel, Switzerland) unless otherwise stated