Abstract
A weak homomorphism from graph G to graph H is a mapping , where either or hold for all . A rectangular grid graph is formed by taking the Cartesian product of two paths. Counting weak homomorphisms is a fundamental problem in graph theory. In this paper, we present formulas for calculating the number of weak homomorphisms from paths to rectangular grid graphs. This count directly corresponds to the number of partial walks with length m within the rectangular grid graph, offering a combinatorial solution to this enumeration problem.
1. Introduction
In mathematics, the image refers to the set of values obtained by applying a mapping to all elements within the domain. Within this image, certain structural properties of the domain are retained. A mapping that maintains such a structure, which is of particular interest for our study, is commonly referred to as a homomorphism. In the context of graphs, a homomorphism is defined as follows.
Consider graphs G and H. A mapping, denoted as is a homomorphism from G to H if for all , meaning that f preserves the edges. The set of homomorphisms from G to H is denoted as . An endomorphism on G is a homomorphism from G to itself, and the set of endomorphisms on G is denoted by . Let represent a path of order n with vertex set and edge set . Similarly, stands for a cycle of order n () with vertices and edges , where the addition is performed modulo n. For a deeper understanding of graphs and algebraic graphs, we direct readers to references [1,2].
Graph homomorphisms, and specifically endomorphisms, have been the subject of much research. Böttcher and Knauer (1992) [3] detailed various ways to define graph homomorphisms, which resulted in six categories of endomorphisms for any given graph: endomorphisms, half-strong endomorphisms, locally strong endomorphisms, quasi-strong endomorphisms, strong endomorphisms, and automorphisms. It is evident that the set of endomorphisms on G constitutes a monoid, wherein the composition of mappings serves as the defining operation. The formulas used to count graph homomorphisms and endomorphisms are essential for analyzing the structure of and , respectively. The expression for determining the number of endomorphisms on was introduced by Arworn in 2009 [4]. Arworn transformed the problem by equating it to enumerating the shortest paths originating from point and reaching any point within an r-ladder square lattice, ultimately deriving a succinct formula. Arworn and Wojtylak [5] also presented a formula in the same year to calculate the number of homomorphisms from path to path . This formula uses the order of the set , where for all . In 2014, Eggleton and Morayne [6] provided identities and formulas for counting homomorphisms of a finite path into a finite path. The paper also presents closed-form formulas for the number of endomorphisms of a finite path. In the same year, Csikvari and Lin [7] studied the number of homomorphisms from a tree with m vertices () to any graph G. They established a lower bound for the number of these homomorphisms in terms of the largest eigenvalue of the adjacency matrix of G. In 2015, Csikvari and Lin [8] further investigated the number of homomorphisms of trees into a path, proving the inequality:
where is any tree on m vertices and denotes the star on m vertices.
The concept of counting standard homomorphisms between graphs has been well studied. However, many problems require a more general mapping, one that allows for the collapsing of edges. This need motivates the introduction of weak homomorphisms, which extend the traditional definition by allowing the edges to be contracted.
When considering a mapping , the concept of f contracting an edge denotes that both vertices x and y are mapped to the same vertex in , i.e., . The central concept is that homomorphisms must preserve the edges. If we also have the option to contract edges, then this achievement can be realized using regular homomorphisms when our graphs contain a loop at every vertex.
A mapping is a weak homomorphism from a graph G to a graph H (also referred to as an egamorphism) if f contracts or preserves the edges, that is, or whenever . A weak homomorphism from G to itself is referred to as a weak endomorphism on G. We denote the set of weak homomorphisms from G to H as WHom() and the set of weak endomorphisms on G as WEnd(G). It is evident that WEnd(G) constitutes a monoid under the composition of mappings. The composition of (weak) homomorphisms also forms a (weak) homomorphism. Consequently, this results in a preorder on graphs and defines a category [1].
Weak homomorphisms extend traditional graph mappings by allowing for edge contraction, offering a versatile tool for analyzing complex networks across disciplines. In computer science, they efficiently simplify large social networks by merging related users, revealing community structures. This ability to abstract while preserving key relationships makes weak homomorphisms valuable for diverse applications.
In 2010, Sirisathianwatthana and Pipattanajinda [9] established the count of weak homomorphisms of cycles as WHom(), expressed in terms of the collection of (), where () represents a set of weak homomorphisms from to , with the conditions that and .
Recently, in 2022, Promsri et al. [10] introduced the number of weak homomorphisms of paths WHom(), by associating it with the order of the following three sets: WHom, WHom, and WHom, where i ranges from 0 to . This motivated us to investigate the number of weak homomorphisms from paths to the product of paths.
For any two graphs and , the Cartesian product of and is the graph with vertices , in which forms an edge if either and , or and .
A rectangular grid graph represents the Cartesian product of and . These graphs, especially when (forming square grids, ), possess a high degree of symmetry, including reflectional, rotational, and near-translational symmetry, a direct consequence of their regular structure. A key connection between paths and these grid graphs arises when considering the mappings between them. Specifically, a mapping f from the vertices of a path to the vertices of the Cartesian product graph (which encompasses rectangular grids) is a homomorphism, if and only if, the sequence of vertices forms a walk within . This crucial observation establishes a one-to-one correspondence between the set of homomorphisms and the set of walks consisting of m vertices within . Similarly, we can establish a one-to-one correspondence between the set WHom() and the collection of partial walks with m vertices in . Here, the partial walk is a sequence obtained by concatenating q walks, namely , for some , and the ending vertex of is the same as the starting vertex of for all .
Yingtaweesittikul et al. (2023) [11] successfully developed formulas for the number of weak homomorphisms from path graphs to ladder graphs () and stacked prism graphs (). Here, we aim to determine formulas for the number of weak homomorphisms from the path graphs to rectangular grid graphs, denoted as ||, which provides a solution to the problem concerning the number of partial walks of m vertices within the rectangular grid graphs .
2. Basic Results and Examples
In 2018, Knauer and Pipattanajinda [12] introduced the count of weak endomorphisms on paths by relating it to the quantities of the shortest paths from the origin point to any arbitrary point within the three-dimensional square lattice, as well as within the r-ladder three-dimensional square lattice. Moreover, they provided formulas for the count of shortest paths from the point to any point , as shown in Proposition 1. Figure 1 and Figure 2 depict the cubic lattice and the 2-ladder cubic lattice when , , and , respectively.
Figure 1.
Cubic lattice.
Figure 2.
2-ladder cubic lattice.
Proposition 1
([12]). The numbers and of the shortest paths from the point to any point in the cubic lattice and in the r-ladder cubic lattice are
and
respectively.
In 2023, Yingtaweesittikul et al. [13] introduced a formula to determine the count of homomorphisms from to , relating it to the order of the set of weak homomorphisms f from to with , denoted as (). This formula provides the solution to the problem concerning the number of walks of order m in the rectangular grid graphs . Moreover, they provided formulas for |()|, as shown in Theorem 1.
Theorem 1
([13]). Let be positive integers and j be a non-negative integer. Let and . Then,
If we let , let , and reduce all of the zero terms, we can obtain the following corollary.
Corollary 1.
Let be positive integers and j be a non-negative integer such that and . Then,
Proof.
□
To better understand the main theorem, we start by examining a straightforward example. Our goal at this stage is to create a visual representation of weak homomorphisms. Check Figure 3 for potential weak homomorphisms from to specifically mapping 0 to 0. The numbers at the top represent elements of the domain set , and those on the left correspond to elements of the image set .
Figure 3.
Graphical presentation of weak homomorphisms f where .
The mappings with and are represented by the dotted line on the top and black line, respectively (see Figure 4).
Figure 4.
Graphical presentation of the domain and image of and .
Figure 5 illustrates weak homomorphisms using the cubic lattice. Multiple cases need consideration. Initially, when , it corresponds to moving from to . Similarly, when , it corresponds to moving from to . For the remaining cases, where , the correspondence involves moving from to . Consequently, the mappings and are depicted by the shortest paths from to and in the 0-ladder cubic lattice, respectively (see Figure 6).
Figure 5.
Cubic lattice presentation of weak homomorphisms f where .
Figure 6.
Cubic lattice presentation of and .
The cardinality is the summation of and where (large black points). From Figure 5, if , we use ; otherwise, .
Similar to the above example, Figure 7 visualizes the possible weak homomorphisms of the path to which map 0 to 1.
Figure 7.
Graphical presentation of weak homomorphisms f where .
The cardinality is the summation of and where (large black points). From Figure 8, if , we use ; otherwise .
Figure 8.
Cubic lattice presentation of weak homomorphisms f where .
3. The Number of (Weak) Homomorphisms from Paths to Paths That Map 0 to
In this section, we present the formula for determining the count of weak homomorphisms from paths to , where 0 is mapped to j. We represent the set of weak homomorphisms from to , with the mapping of 0 to j, as ().
Theorem 2.
Let be positive integers and j be a non-negative integer, such that and . Then,
Proof.
To find , we count the number of shortest paths from the point to any point , where in the j-ladder cubic lattice. Consider the following four different cases corresponding to the value of . For each case, the points are on the blue arrows in Figure 9, Figure 10, Figure 11 and Figure 12, respectively.
Figure 9.
The blue arrows containing points where .
Figure 10.
The blue arrows containing points where .
Figure 11.
The blue arrows containing points where and .
Figure 12.
The blue arrows containing points where and .
- Case 1: . For each , there are shortest paths.As , we obtain
- Case 2: and . For each , there are shortest paths. Since , we obtain
- Case 3: and . For each , there are shortest paths. We obtain
- Case 4: and . For each , there are shortest paths. This can be obtained by flipping the cubic lattice diagonally.
As , we obtain
Adding up over all of the cases, is as desired. □
For convenience, we compute and for . The results are presented in Table 1 and Table 2, respectively.
Table 1.
Numbers of weak homomorphisms where for
Table 2.
Numbers of homomorphisms where for
4. The Number of Weak Homomorphisms from Paths to Grid Graphs
In this section, we present the formulas for determining the count of weak homomorphisms from paths to rectangular grid graphs . We represent the set of weak homomorphisms from to , mapping 0 to , as . From the symmetry of , we deduce the following lemma:
Lemma 1.
Let i and n be integers, such that , and let be a positive integer.
- 1.
- ,for all and .
- 2.
- .
- 3.
- .
- 4.
- .
- 5.
- .
Example 1.
.
Figure 13 shows all possible weak homomorphisms from to which map 0 to . The numbers on top are the elements of domain set and the tuples on the left are elements of image set . The tuples with the same second elements are represented by the circle with the same color.
Figure 13.
Graphical presentation of the domain and image of all possible weak homomorphisms where . Lines: black (increment 1st), dashed black (decrement 1st), magenta (increment 2nd), dashed magenta (decrement 2nd), cyan (no change).
We noted that normal black lines represent the increment of the first coordinate, dashed black lines represent the decrement of the first coordinate, normal magenta lines represent the increment of the second coordinate, magenta lines represent the decrement of the second coordinate, and cyan lines represent no change in both coordinates.
We now divide all the mappings in into groups according to the number of changes in the first coordinate h, and rewrite each path as two shorter paths (see Table 3). The first path is formed by gray lines. On the other hand, the second path consists of cyan and magenta lines. In both paths, the lines are arranged in sequential order.
Table 3.
The mappings in grouped by changes in the first coordinate (h). Each path is divided into two: gray lines (first path) and cyan/magenta lines (second path).
Theorem 3.
Let and k be positive integers and be non-negative integers, such that and . It follows that
Proof.
Let . For each in the domain, either or , where . Assume changes in the first coordinate appear h times. Then, changes in the second coordinate appear times. The sequence of changes in the first coordinate form a homomorphism . Similarly, the sequence of remaining changes (and no changes) in the second coordinate form a weak homomorphism . Thus, the corresponding path graph of f can be obtained from the permutations of all edges in path graphs of and with a fixed sequential order. There are permutations in total. Hence, □
From Lemma 1 and Theorem 3, we obtain the theorem below.
Theorem 4.
The cardinalities of the weak homomorphisms from undirected paths to grid graphs are
where .
For convenience, we compute for The results are presented in Table 4.
Table 4.
Numbers of weak homomorphisms for
5. Applications of the Number of Weak Homomorphisms from Paths to Rectangular Grid Graphs
The concept of partial walks, defined as sequences of concatenated walks, where the end of one walk coincides with the start of the next, offers a powerful tool for modeling and analyzing diverse phenomena within rectangular grid graphs. Crucially, the number of such partial walks with length m within a rectangular grid graph directly captured by the number of weak homomorphisms from a path graph to . This connection provides a powerful mathematical framework for enumerating and analyzing these walks. This approach finds particular relevance in scenarios involving segmented or interrupted movement, information flow, and pattern recognition.
In robotics and path planning, the enumeration of these partial walks can represent the count of possible robot navigation paths through complex environments, accommodating pauses, task-specific stops, and dynamic obstacle avoidance. For instance, knowing this count allows us to quantify the number of distinct m-step movement sequences a robot could take. In network analysis and data routing, this enumeration models the count of possible packet transmission paths with delays or interruptions, effectively capturing the flow of information through networks where nodes introduce pauses or processing steps. Similarly, in image processing and computer vision, this enumeration quantifies the number of ways to trace pixel connectivity in edge detection or pattern recognition, allowing for the statistical analysis of patterns composed of non-contiguous segments. Moreover, in combinatorial problems and game theory, this enumeration enables the modeling and counting of constrained movements, such as player actions in grid-based games, and provides a framework for enumerating the number of possible sequences of actions in scenarios with intermittent actions. By leveraging the connection between the enumeration of weak homomorphisms and the counting of partial walks, we gain a deeper quantitative understanding of a wide range of real-world phenomena represented by rectangular grid graphs.
6. Conclusions
This paper has introduced formulas aimed at determining the number of weak homomorphisms from paths to rectangular grid graphs . These formulas are expressed in terms of and for all . The proposed formulas serve as a solution to the specific problem of enumerating the number of partial walks of m vertices within the rectangular grid graphs.
Author Contributions
Conceptualization, S.P.; methodology, S.P. and P.R.; software, H.Y.; validation, H.Y. and P.R.; investigation, P.R. and H.Y.; writing—original draft, P.R. and S.P.; writing—review and editing, H.Y. and S.P.; visualization, H.Y., P.R., and S.P. All authors have read and agreed to the published version of the manuscript.
Funding
This research was funded by Chiang Mai University.
Data Availability Statement
Data are contained within the article.
Acknowledgments
This research was partially supported by Fundamental Fund 2025, Chiang Mai University, Thailand; Faculty of Science, Chiang Mai University, Thailand; and Chiang Mai University, Thailand.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Knauer, U.; Knauer, K. Algebraic Graph Theory: Morphisms, Monoids and Matrices; De Gruyter: Berlin, Germany, 2011. [Google Scholar]
- Hell, P.; Nestril, J. Graphs and Homomorphisms; Oxford University Press: Oxford, UK, 2004. [Google Scholar]
- Böttcher, M.; Knauer, U. Endomorphism spectra of graphs. Discret. Math. 1992, 109, 45–57. [Google Scholar]
- Arworn, S. An algorithm for the numbers of endomorphisms on paths. Discret. Math. 2009, 309, 94–103. [Google Scholar]
- Arworn, S.; Wojtylak, P. An algorithm for the number of path homomorphisms. Discret. Math. 2009, 309, 5569–5573. [Google Scholar] [CrossRef] [Scilit]
- Eggleton, R.B.; Morayne, M. A Note on Counting Homomorphisms of Paths. Graphs Comb. 2014, 30, 159–170. [Google Scholar] [CrossRef] [Scilit]
- Csikvari, P.; Lin, Z. Graph homomorphisms between trees. Electron. J. Combin. 2014, 21, 4.9. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Csikvari, P.; Lin, Z. Homomorphisms of Trees into a Path. Siam J. Discret. Math. 2015, 29, 1406–1422. [Google Scholar] [CrossRef] [Scilit]
- Sirisathianwatthana, P.; Pipattanajinda, N. Finding the number of cycle egamorphisms. Thai J. Math. 2010, 8, 1–9. [Google Scholar]
- Pomsri, T.; Wannasit, W.; Panma, S. Finding the Number of Weak Homomorphisms of Paths. J. Math. 2022, 2022, 2153927. [Google Scholar] [CrossRef] [Scilit]
- Yingtaweesittikul, H.; Panma, S.; Rochanakul, P. Formulas for the Number of Weak Homomorphisms from Paths to Ladder Graphs and Stacked Prism Graphs. J. Math. 2023, 2023, 159532. [Google Scholar]
- Knauer, U.; Pipattanajinda, N. A formula for the number of weak endomorphisms on paths. Algebra Discret. Math. 2018, 26, 270–279. [Google Scholar]
- Yingtaweesittikul, H.; Panma, S.; Rochanakul, P. An Algorithm for the Numbers of Homomorphisms from Paths to Rectangular Grid Graphs. Mathematics 2023, 11, 2587. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
















