Next Article in Journal
Optimal Control of Stochastic Dynamic Systems with Semi-Markov Parameters
Previous Article in Journal
Enhancing Cryptocurrency Security: Leveraging Embeddings and Large Language Models for Creating Cryptocurrency Security Expert Systems
Previous Article in Special Issue
Edge-Irregular Reflexive Strength of Non-Planar Graphs
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Formulas for the Number of Weak Homomorphisms from Paths to Rectangular Grid Graphs

by
Penying Rochanakul
1,
Hatairat Yingtaweesittikul
1,2 and
Sayan Panma
1,2,*
1
Department of Mathematics, Faculty of Science, Chiang Mai University, Chiang Mai 50200, Thailand
2
Advanced Research Center for Computational Simulation, Chiang Mai University, Chiang Mai 50200, Thailand
*
Author to whom correspondence should be addressed.
Symmetry 2025, 17(4), 497; https://doi.org/10.3390/sym17040497
Submission received: 12 February 2025 / Revised: 17 March 2025 / Accepted: 23 March 2025 / Published: 26 March 2025
(This article belongs to the Special Issue Symmetry and Graph Theory, 2nd Edition)

Abstract

:
A weak homomorphism from graph G to graph H is a mapping f : V ( G ) V ( H ) , where either f ( x ) = f ( y ) or { f ( x ) , f ( y ) } E ( H ) hold for all { x , y } E ( G ) . 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 f : V ( G ) V ( H ) , is a homomorphism from G to H if { f ( x ) , f ( y ) } E ( H ) for all { x , y } E ( G ) , meaning that f preserves the edges. The set of homomorphisms from G to H is denoted as Hom ( G , H ) . An endomorphism on G is a homomorphism from G to itself, and the set of endomorphisms on G is denoted by End ( G ) . Let P n represent a path of order n with vertex set V ( P n ) = { 0 , 1 , , n 1 } and edge set E ( P n ) = { { i , i + 1 } | i = 0 , 1 , , n 2 } . Similarly, C n stands for a cycle of order n ( n 3 ) with vertices V ( C n ) = { 0 , 1 , , n 1 } and edges E ( C n ) = { { i , i + 1 } | i = 0 , 1 , , n 1 } , 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 Hom ( G , H ) and End ( G ) , respectively. The expression for determining the number of endomorphisms on P n was introduced by Arworn in 2009 [4]. Arworn transformed the problem by equating it to enumerating the shortest paths originating from point ( 0 , 0 ) and reaching any point ( i , j ) 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 P m to path P n . This formula uses the order of the set Hom j i ( P m , P n ) , where Hom j i ( P m , P n ) = { f Hom ( P m , P n ) f ( 0 ) = i , f ( m 1 ) = j } for all i , j { 0 , 1 , , n 1 } . 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 ( T m ) 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:
| Hom ( P m , P n ) | | Hom ( T m , P n ) | | Hom ( S m , P n ) |
where T m is any tree on m vertices and S m 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 f : V ( G ) V ( H ) , the concept of f contracting an edge { x , y } denotes that both vertices x and y are mapped to the same vertex in V ( H ) , i.e., f ( x ) = f ( y ) . 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 f : V ( G ) V ( H ) 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, f ( x ) = f ( y ) or { f ( x ) , f ( y ) } E ( H ) whenever { x , y } E ( G ) . 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( G , H ) 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( C m , C n ), expressed in terms of the collection of WHom j i ( P m 1 , C n ), where WHom j i ( P m 1 , C n ) represents a set of weak homomorphisms from P m 1 to C n , with the conditions that f ( 0 ) = i and f ( m 1 ) = j .
Recently, in 2022, Promsri et al. [10] introduced the number of weak homomorphisms of paths WHom( P m , P n ), by associating it with the order of the following three sets: A m 1 , n i = { f WHom ( P m 1 , P n ) | f ( 0 ) = i } , B m 1 , n i = { f WHom ( P m 1 , P n ) | f ( 0 ) = i and f ( m 2 ) = 0 } , and C m 1 , n i = { f WHom ( P m 1 , P n ) | f ( 0 ) = i and f ( m 2 ) = n 1 } , where i ranges from 0 to n 1 . This motivated us to investigate the number of weak homomorphisms from paths to the product of paths.
For any two graphs G 1 and G 2 , the Cartesian product of G 1 and G 2 is the graph G 1 G 2 with vertices V ( G 1 G 2 ) = V ( G 1 ) × V ( G 2 ) , in which { ( a , u ) , ( b , v ) } forms an edge if either a = b and { u , v } E ( G 2 ) , or { a , b } E ( G 1 ) and u = v .
A rectangular grid graph P n P k represents the Cartesian product of P n and P k . These graphs, especially when n = k (forming square grids, P n P n ), 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 P m to the vertices of the Cartesian product graph G 1 G 2 (which encompasses rectangular grids) is a homomorphism, if and only if, the sequence of vertices f ( 0 ) , f ( 1 ) , , f ( m 1 ) forms a walk within G 1 G 2 . This crucial observation establishes a one-to-one correspondence between the set of homomorphisms f : P m G 1 G 2 and the set of walks consisting of m vertices within G 1 G 2 . Similarly, we can establish a one-to-one correspondence between the set WHom( P m , G 1 G 2 ) and the collection of partial walks with m vertices in G 1 G 2 . Here, the partial walk is a sequence obtained by concatenating q walks, namely W 1 , W 2 , , W q , for some q N , and the ending vertex of W i is the same as the starting vertex of W i + 1 for all i = 1 , 2 , , q 1 .
Yingtaweesittikul et al. (2023) [11] successfully developed formulas for the number of weak homomorphisms from path graphs to ladder graphs ( P n P 2 ) and stacked prism graphs ( P n C k ). Here, we aim to determine formulas for the number of weak homomorphisms from the path graphs to rectangular grid graphs, denoted as | WHom ( P m , P n P k ) |, which provides a solution to the problem concerning the number of partial walks of m vertices within the rectangular grid graphs P n P k .

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 ( 0 , 0 , 0 ) to any arbitrary point ( i , j , k ) 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 ( 0 , 0 , 0 ) to any point ( i , j , k ) , as shown in Proposition 1. Figure 1 and Figure 2 depict the cubic lattice and the 2-ladder cubic lattice when i = 6 , j = 4 , and k = 4 , respectively.
Proposition 1
([12]). The numbers M ( i , j , k ) and M r ( i , j , k ) of the shortest paths from the point ( 0 , 0 , 0 ) to any point ( i , j , k ) in the cubic lattice and in the r-ladder cubic lattice are
M ( i , j , k ) = i + j + k i , j , k
and
M r ( i , j , k ) = i + j + k i , j , k i + j + k j r 1 , i + r + 1 , k ,
respectively.
In 2023, Yingtaweesittikul et al. [13] introduced a formula to determine the count of homomorphisms from P m to P n P k , relating it to the order of the set of weak homomorphisms f from P m to P n with f ( 0 ) = j , denoted as Hom j ( P m , P n ). This formula provides the solution to the problem concerning the number of walks of order m in the rectangular grid graphs P n P k . Moreover, they provided formulas for | Hom j ( P m , P n )|, as shown in Theorem 1.
Theorem 1
([13]). Let m , n be positive integers and j be a non-negative integer. Let L = max { 0 , m j 1 2 } and U = min { m 1 , m + n j 2 2 } . Then,
| Hom j ( P m , P n ) | = i = L U | t | m + n n m 1 i t ( n + 1 ) m 1 i + j t ( n + 1 ) + 1 .
If we let m n , let j < n , and reduce all of the zero terms, we can obtain the following corollary.
Corollary 1.
Let m , n be positive integers and j be a non-negative integer such that m n and j < n . Then,
| Hom j ( P m , P n ) | = t = m a x 0 , j ( n m ) 2 m + j 2 1 m 1 t t = 0 j ( n m ) 2 1 m 1 t t = 0 m j 1 2 1 m 1 t .
Proof. 
As m n , m + n n 2 . Thus, t { 2 , 1 , 0 , 1 , 2 } and Equation (1) can be reduced to
| Hom j ( P m , P n ) | = i = L U m 1 i + 2 n + 2 m 1 i + j + 2 n + 3 + m 1 i + n + 1 m 1 i + j + n + 2 + m 1 i m 1 i + j + 1 + m 1 i n 1 m 1 i + j n + m 1 i 2 n 2 m 1 i + j 2 n 1 .
As m 1 i + 2 n + 2 , m 1 i + j + 2 n + 3 , m 1 i + n + 1 , m 1 i + j + n + 2 , m 1 i n 1 , m 1 i 2 n 2 , and m 1 i + j 2 n 1 are all zeros, we have
| Hom j ( P m , P n ) | = i = L U m 1 i m 1 i + j + 1 m 1 i + j n = i = L U m 1 i i = L U m 1 i + j + 1 i = L U m 1 i + j n = i = L U m 1 ( m 1 ) i i = L U m 1 ( m 1 ) i j 1 i = L U m 1 i + j n = t = ( m 1 ) U ( m 1 ) L m 1 t t = ( m 1 ) j 1 U ( m 1 ) j 1 L m 1 t t = L + j n U + j n m 1 t = t = m a x 0 , j ( n m ) 2 m + j 2 1 m 1 t t = 0 m j 1 2 1 m 1 t t = 0 j ( n m ) 2 1 m 1 t .
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 P 4 to P 5 specifically mapping 0 to 0. The numbers at the top represent elements of the domain set V ( P 4 ) , and those on the left correspond to elements of the image set V ( P 5 ) .
The mappings f 1 , f 2 WHom 0 ( P 4 , P 5 ) with f 1 ( 0 ) = 0 , f 1 ( 1 ) = 0 , f 1 ( 2 ) = 0 , f 1 ( 3 ) = 0 and f 2 ( 0 ) = 0 , f 2 ( 1 ) = 1 , f 2 ( 2 ) = 2 , f 2 ( 3 ) = 3 are represented by the dotted line on the top and black line, respectively (see Figure 4).
Figure 5 illustrates weak homomorphisms using the cubic lattice. Multiple cases need consideration. Initially, when f ( x + 1 ) = f ( x ) + 1 , it corresponds to moving from ( i , j , k ) to ( i + 1 , j , k ) . Similarly, when f ( x + 1 ) = f ( x ) 1 , it corresponds to moving from ( i , j , k ) to ( i , j + 1 , k ) . For the remaining cases, where f ( x + 1 ) = f ( x ) , the correspondence involves moving from ( i , j , k ) to ( i , j , k + 1 ) . Consequently, the mappings f 1 and f 2 are depicted by the shortest paths from ( 0 , 0 , 0 ) to ( 0 , 0 , 3 ) and ( 3 , 0 , 0 ) in the 0-ladder cubic lattice, respectively (see Figure 6).
The cardinality | WHom 0 ( P 4 , P 5 ) | is the summation of M ( i , j , k ) and M 0 ( i , j , k ) where i + j + k = 3 (large black points). From Figure 5, if j 0 , we use M ( i , j , k ) ; otherwise, M 0 ( i , j , k ) .
| WHom 0 ( P 4 , P 5 ) | = M ( 3 , 0 , 0 ) + M 0 ( 2 , 1 , 0 ) + M ( 2 , 0 , 1 ) + M 0 ( 1 , 1 , 1 ) + M ( 1 , 0 , 2 ) + M ( 0 , 0 , 3 ) = 3 3 , 0 , 0 + 3 2 , 1 , 0 3 0 , 3 , 0 + 3 2 , 0 , 1 + 3 1 , 1 , 1 3 0 , 2 , 1 + 3 1 , 0 , 2 + 3 0 , 0 , 3 = 13 .
Similar to the above example, Figure 7 visualizes the possible weak homomorphisms of the path P 4 to P 5 which map 0 to 1.
The cardinality | WHom 1 ( P 4 , P 5 ) | is the summation of M ( i , j , k ) and M 1 ( i , j , k ) where i + j + k = 3 (large black points). From Figure 8, if j 1 , we use M ( i , j , k ) ; otherwise M 1 ( i , j , k ) .
| WHom 1 ( P 4 , P 5 ) | = M ( 2 , 1 , 0 ) + M 1 ( 1 , 2 , 0 ) + M ( 2 , 0 , 1 ) + M ( 1 , 1 , 1 ) + M ( 1 , 0 , 2 ) + M ( 0 , 1 , 2 ) + M ( 0 , 0 , 3 ) + M ( 3 , 0 , 0 ) = 3 2 , 1 , 0 + 3 1 , 2 , 0 3 0 , 3 , 0 + 3 2 , 0 , 1 + 3 1 , 1 , 1 + 3 1 , 0 , 2 + 3 0 , 1 , 2 + 3 0 , 0 , 3 + 3 3 , 0 , 0 = 22 .

3. The Number of (Weak) Homomorphisms from Paths to Paths That Map 0 to j

In this section, we present the formula for determining the count of weak homomorphisms from paths P m to P n , where 0 is mapped to j. We represent the set of weak homomorphisms from P m to P n , with the mapping of 0 to j, as WHom j ( P m , P n ).
Theorem 2.
Let m , n be positive integers and j be a non-negative integer, such that m n and j < n . Then,
| WHom j ( P m , P n ) | = t = j + 1 j + m j 1 2 s = t j m 1 t m 1 s , t , m 1 s t m 1 t j 1 , s + j + 1 , m 1 s t + t = m a x { j n + m + 1 , 0 } j s = 0 m 1 t m 1 s , t , m 1 s t + t = 0 j n + m s = 0 n j 1 m 1 s , t , m 1 s t + t = n j 1 + 1 n j 1 + j n + m 2 s = t ( n j 1 ) m 1 t m 1 s , t , m 1 s t m 1 t n + j , s + n j , m 1 s t .
Proof. 
To find | WHom j ( P m , P n ) | , we count the number of shortest paths from the point ( 0 , 0 , 0 ) to any point ( i 0 , j 0 , k 0 ) , where i 0 + j 0 + k 0 = m 1 in the j-ladder cubic lattice. Consider the following four different cases corresponding to the value of j 0 . For each case, the points ( i 0 , j 0 ) are on the blue arrows in Figure 9, Figure 10, Figure 11 and Figure 12, respectively.
  • Case 1:  j 0 > j . For each j 0 = j + t , there are i 0 = t m j 1 t M j ( i 0 , j 0 , k 0 ) shortest paths.
    As t m j 1 2 , we obtain
    t = 1 m j 1 2 i 0 = t m j 1 t M j ( i 0 , j + t , k 0 ) = t = j + 1 j + m j 1 2 s = t j m 1 t M j ( s , t , m 1 s t ) = t = j + 1 j + m j 1 2 s = t j m 1 t m 1 s , t , m 1 s t m 1 t j 1 , s + j + 1 , m 1 s t .
  • Case 2:  j n + m < j 0 j and i 0 < n j 1 . For each j 0 = j t , there are i 0 = 0 m j 1 + t M ( i 0 , j 0 , k 0 ) shortest paths. Since t < n m , we obtain
    t = 0 n m 1 i 0 = 0 m j 1 + t M ( i 0 , j t , k 0 ) = t = m a x { j n + m + 1 , 0 } j s = 0 m 1 t M ( s , t , m 1 s t ) = t = m a x { j n + m + 1 , 0 } j s = 0 m 1 t m 1 s , t , m 1 s t .
  • Case 3:  j 0 j n + m j and i 0 n j 1 . For each i 0 , j 0 , there are M ( i 0 , j 0 , k 0 ) shortest paths. We obtain
    j 0 = 0 j n + m i 0 = 0 n j 1 M ( i 0 , j 0 , k 0 ) = t = 0 j n + m s = 0 n j 1 M ( s , t , m 1 s t ) = t = 0 j n + m s = 0 n j 1 m 1 s , t , m 1 s t .
  • Case 4:  j 0 j and i 0 > n j 1 . For each i 0 = n j 1 + t , there are j 0 = t j n + m t M n j 1 ( j 0 , i 0 , k 0 ) shortest paths. This can be obtained by flipping the cubic lattice diagonally.
As t j n + m 2 , we obtain
t = 1 j n + m 2 j 0 = t j n + m t M n j 1 ( j 0 , n j 1 + t , k 0 ) = t = n j 1 + 1 n j 1 + j n + m 2 s = t ( n j 1 ) m 1 t M n j 1 ( s , t , m 1 s t ) = t = n j 1 + 1 n j 1 + j n + m 2 s = t ( n j 1 ) m 1 t m 1 s , t , m 1 s t m 1 t n + j , s + n j , m 1 s t .
Adding up over all of the cases, | WHom j ( P m , P n ) | is as desired. □
For convenience, we compute | WHom j ( P m , P n ) | and | Hom j ( P m , P n ) | for 2 m n 8 . The results are presented in Table 1 and Table 2, respectively.

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 P m to rectangular grid graphs P n P k . We represent the set of weak homomorphisms from P m to P n P k , mapping 0 to ( i , j ) , as WHom i j ( P m , P n P k ) . From the symmetry of P n P k , we deduce the following lemma:
Lemma 1.
Let i and n be integers, such that 0 j < n , and let m > 2 be a positive integer.
1. 
| WHom i j ( P m , P n P k ) | = | WHom ( n i 1 ) j ( P m , P n P k ) |
= | WHom i ( k j 1 ) ( P m , P n P k ) |
= | WHom ( n i 1 ) ( k j 1 ) ( P m , P n P k ) | ,
    for all i { 0 , 1 , , n 1 } and j { 0 , 1 , , k 1 } .
2. 
| WHom ( P m , P 2 n P 2 k ) | = 4 i = 0 n 1 j = 0 k 1 | WHom i j ( P m , P 2 n P 2 k ) | .
3. 
| WHom ( P m , P 2 n + 1 P 2 k ) | = 4 i = 0 n 1 j = 0 k 1 | WHom i j ( P m , P 2 n + 1 P 2 k ) |
+ 2 j = 0 k 1 | WHom n j ( P m , P 2 n + 1 P 2 k ) | .
4. 
| WHom ( P m , P 2 n P 2 k + 1 ) | = 4 i = 0 n 1 j = 0 k 1 | WHom i j ( P m , P 2 n P 2 k + 1 ) |
+ 2 i = 0 n 1 | WHom i k ( P m , P 2 n P 2 k + 1 ) | .
5. 
| WHom ( P m , P 2 n + 1 P 2 k + 1 ) |
= 4 i = 0 n 1 j = 0 k 1 | WHom i j ( P m , P 2 n + 1 P 2 k + 1 ) |
+ 2 j = 0 k 1 | WHom n j ( P m , P 2 n + 1 P 2 k + 1 ) |
+ 2 i = 0 n 1 | WHom i k ( P m , P 2 n + 1 P 2 k + 1 ) |
+ | WHom n k ( P m , P 2 n + 1 P 2 k + 1 ) | .
Example 1.
| WHom 00 ( P 4 , P 4 P 5 ) | = 43 .
Figure 13 shows all possible weak homomorphisms from P 4 to P 4 P 5 which map 0 to ( 0 , 0 ) . The numbers on top are the elements of domain set V ( P 4 ) and the tuples on the left are elements of image set V ( P 4 P 5 ) . The tuples with the same second elements are represented by the circle with the same color.
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 WHom 00 ( P 4 , P 4 P 5 ) 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.
| WHom 00 ( P 4 , P 4 P 5 ) | = 3 0 | Hom 0 ( P 1 , P 4 ) | | WHom 0 ( P 4 , P 5 ) | + 3 1 | Hom 0 ( P 2 , P 4 ) | | WHom 0 ( P 3 , P 5 ) | + 3 2 | Hom 0 ( P 3 , P 4 ) | | WHom 0 ( P 2 , P 5 ) | + 3 3 | Hom 0 ( P 4 , P 4 ) | | WHom 0 ( P 1 , P 5 ) | = 1 ( 1 ) ( 13 ) + 3 ( 1 ) ( 5 ) + 3 ( 2 ) ( 2 ) + 1 ( 3 ) ( 1 ) = 43 .
Theorem 3.
Let m , n and k be positive integers and i , j be non-negative integers, such that i < n 2 1 and j < k 2 1 . It follows that
| WHom i j ( P m , P n P k ) | = h = 0 m 1 m 1 h | Hom i ( P h + 1 , P n ) | | WHom j ( P m h , P k ) | .
Proof. 
Let f WHom i j ( P m , P n P k ) . For each x { 0 , 1 , m 2 } in the domain, either f ( x + 1 ) = f ( x ) ± ( 1 , 0 ) or f ( x + 1 ) = f ( x ) ± ( 0 , t ) , where t { 0 , 1 } . Assume changes in the first coordinate appear h times. Then, changes in the second coordinate appear m 1 h times. The sequence of changes in the first coordinate form a homomorphism f 1 Hom i ( P h + 1 , P n ) . Similarly, the sequence of remaining changes (and no changes) in the second coordinate form a weak homomorphism f 2 WHom i ( P m 1 h + 1 , P k ) . Thus, the corresponding path graph of f can be obtained from the permutations of all edges in path graphs of f 1 and f 2 with a fixed sequential order. There are m 1 h permutations in total. Hence, | WHom i j ( P m , P n P k ) | = h = 0 m 1 m 1 h | Hom i ( P h + 1 , P n ) | | WHom j ( P m h , P k ) | .
From Lemma 1 and Theorem 3, we obtain the theorem below.
Theorem 4.
The cardinalities | WHom ( P m , P n P k ) | of the weak homomorphisms from undirected paths P m to grid graphs P n P k are
| WHom ( P m , P n P k ) | = 4 i = 0 n / 2 1 j = 0 k / 2 1 | WHom i j ( P m , P n P k ) | + ( 1 ( 1 ) n ) j = 0 k / 2 1 | WHom n / 2 j ( P m , P n P k ) | + ( 1 ( 1 ) k ) i = 0 n / 2 1 | WHom i k / 2 ( P m , P n P k ) | + ( 1 / 4 ) ( 1 ( 1 ) n ) ( 1 ( 1 ) k ) | WHom n / 2 k / 2 ( P m , P n P k ) |
where  | WHom i j ( P m , P n P k ) | = h = 0 m 1 m 1 h | Hom i ( P h + 1 , P n ) | | WHom j ( P m h , P k ) | .
For convenience, we compute | WHom ( P m , P n P k ) | for 2 m n , k 8 . The results are presented in Table 4.

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 P n P k directly captured by the number of weak homomorphisms from a path graph P m to P n P k . 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 P m to rectangular grid graphs P n P k . These formulas are expressed in terms of | Hom i ( P h + 1 , P n ) | and | WHom j ( P m h , P k ) | for all h = 0 , 1 , , m 1 . 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

  1. Knauer, U.; Knauer, K. Algebraic Graph Theory: Morphisms, Monoids and Matrices; De Gruyter: Berlin, Germany, 2011. [Google Scholar]
  2. Hell, P.; Nestril, J. Graphs and Homomorphisms; Oxford University Press: Oxford, UK, 2004. [Google Scholar]
  3. Böttcher, M.; Knauer, U. Endomorphism spectra of graphs. Discret. Math. 1992, 109, 45–57. [Google Scholar]
  4. Arworn, S. An algorithm for the numbers of endomorphisms on paths. Discret. Math. 2009, 309, 94–103. [Google Scholar]
  5. Arworn, S.; Wojtylak, P. An algorithm for the number of path homomorphisms. Discret. Math. 2009, 309, 5569–5573. [Google Scholar] [CrossRef]
  6. Eggleton, R.B.; Morayne, M. A Note on Counting Homomorphisms of Paths. Graphs Comb. 2014, 30, 159–170. [Google Scholar] [CrossRef]
  7. Csikvari, P.; Lin, Z. Graph homomorphisms between trees. Electron. J. Combin. 2014, 21, 4.9. [Google Scholar] [CrossRef] [PubMed]
  8. Csikvari, P.; Lin, Z. Homomorphisms of Trees into a Path. Siam J. Discret. Math. 2015, 29, 1406–1422. [Google Scholar] [CrossRef]
  9. Sirisathianwatthana, P.; Pipattanajinda, N. Finding the number of cycle egamorphisms. Thai J. Math. 2010, 8, 1–9. [Google Scholar]
  10. Pomsri, T.; Wannasit, W.; Panma, S. Finding the Number of Weak Homomorphisms of Paths. J. Math. 2022, 2022, 2153927. [Google Scholar] [CrossRef]
  11. 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]
  12. Knauer, U.; Pipattanajinda, N. A formula for the number of weak endomorphisms on paths. Algebra Discret. Math. 2018, 26, 270–279. [Google Scholar]
  13. 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]
Figure 1. Cubic lattice.
Figure 1. Cubic lattice.
Symmetry 17 00497 g001
Figure 2. 2-ladder cubic lattice.
Figure 2. 2-ladder cubic lattice.
Symmetry 17 00497 g002
Figure 3. Graphical presentation of weak homomorphisms f where f ( 0 ) = 0 .
Figure 3. Graphical presentation of weak homomorphisms f where f ( 0 ) = 0 .
Symmetry 17 00497 g003
Figure 4. Graphical presentation of the domain and image of f 1 and f 2 .
Figure 4. Graphical presentation of the domain and image of f 1 and f 2 .
Symmetry 17 00497 g004
Figure 5. Cubic lattice presentation of weak homomorphisms f where f ( 0 ) = 0 .
Figure 5. Cubic lattice presentation of weak homomorphisms f where f ( 0 ) = 0 .
Symmetry 17 00497 g005
Figure 6. Cubic lattice presentation of f 1 and f 2 .
Figure 6. Cubic lattice presentation of f 1 and f 2 .
Symmetry 17 00497 g006
Figure 7. Graphical presentation of weak homomorphisms f where f ( 0 ) = 1 .
Figure 7. Graphical presentation of weak homomorphisms f where f ( 0 ) = 1 .
Symmetry 17 00497 g007
Figure 8. Cubic lattice presentation of weak homomorphisms f where f ( 0 ) = 1 .
Figure 8. Cubic lattice presentation of weak homomorphisms f where f ( 0 ) = 1 .
Symmetry 17 00497 g008
Figure 9. The blue arrows containing points ( i 0 , j 0 ) where j 0 > j .
Figure 9. The blue arrows containing points ( i 0 , j 0 ) where j 0 > j .
Symmetry 17 00497 g009
Figure 10. The blue arrows containing points ( i 0 , j 0 ) where j n + m < j 0 j .
Figure 10. The blue arrows containing points ( i 0 , j 0 ) where j n + m < j 0 j .
Symmetry 17 00497 g010
Figure 11. The blue arrows containing points ( i 0 , j 0 ) where j 0 < j n + m and i 0 n j 1 .
Figure 11. The blue arrows containing points ( i 0 , j 0 ) where j 0 < j n + m and i 0 n j 1 .
Symmetry 17 00497 g011
Figure 12. The blue arrows containing points ( i 0 , j 0 ) where j 0 < j n + m and i 0 > n j 1 .
Figure 12. The blue arrows containing points ( i 0 , j 0 ) where j 0 < j n + m and i 0 > n j 1 .
Symmetry 17 00497 g012
Figure 13. Graphical presentation of the domain and image of all possible weak homomorphisms f : P 4 P 4 P 5 where f ( 0 ) = ( 0 , 0 ) . Lines: black (increment 1st), dashed black (decrement 1st), magenta (increment 2nd), dashed magenta (decrement 2nd), cyan (no change).
Figure 13. Graphical presentation of the domain and image of all possible weak homomorphisms f : P 4 P 4 P 5 where f ( 0 ) = ( 0 , 0 ) . Lines: black (increment 1st), dashed black (decrement 1st), magenta (increment 2nd), dashed magenta (decrement 2nd), cyan (no change).
Symmetry 17 00497 g013
Table 1. Numbers of weak homomorphisms f : P m P n where f ( 0 ) = j for 2 m n 8 .
Table 1. Numbers of weak homomorphisms f : P m P n where f ( 0 ) = j for 2 m n 8 .
n
m j 2345678
202222222
1 333333
2 3333
3 33
30 555555
1 788888
2 9999
3 99
40 1313131313
1 2122222222
2 25262626
3 2727
50 35353535
1 60616161
2 69747575
3 7980
60 969696
1 170171171
2 209215216
3 229235
70 267267
1 482483
2 615622
3 659686
80 750
1 1372
2 1791
3 1994
Table 2. Numbers of homomorphisms f : P m P n where f ( 0 ) = j for 2 m n 8 .
Table 2. Numbers of homomorphisms f : P m P n where f ( 0 ) = j for 2 m n 8 .
n
m j 2345678
201111111
1 222222
2 2222
3 22
30 222222
1 233333
2 4444
3 44
40 33333
1 56666
2 6777
3 88
50 6666
1 9101010
2 12131414
3 1415
60 101010
1 192020
2 232425
3 2829
70 2020
1 3435
2 4849
3 4854
80 35
1 69
2 89
3 103
Table 3. The mappings in WHom 00 ( P 4 , P 4 P 5 ) grouped by changes in the first coordinate (h). Each path is divided into two: gray lines (first path) and cyan/magenta lines (second path).
Table 3. The mappings in WHom 00 ( P 4 , P 4 P 5 ) grouped by changes in the first coordinate (h). Each path is divided into two: gray lines (first path) and cyan/magenta lines (second path).
h f WHom 00 ( P 4 , P 4 P 5 ) with Changes in the First Coordinate h TimesPaths Represent Each f WHom 00 ( P 4 , P 4 P 5 ) (Expanded Diagram) P h + 1 and P 4 h
0Symmetry 17 00497 i001
1Symmetry 17 00497 i002
2Symmetry 17 00497 i003
3Symmetry 17 00497 i004
Table 4. Numbers of weak homomorphisms f : P m P n P k for 2 m n , k 8 .
Table 4. Numbers of weak homomorphisms f : P m P n P k for 2 m n , k 8 .
k
m n 2345678
2212202836445260
320334659728598
428466482100118136
5365982105128151174
64472100128156184212
75285118151184217250
86098136174212250288
33 125182239296353410
4 182264346428510592
5 239346453560667774
6 296428560692824956
7 3535106678249811138
8 41059277495611381320
44 11041480185622322608
5 14801981248229833484
6 18562482310837344360
7 22322983373444855236
8 26083484436052366112
55 873311,08813,44315,798
6 11,08814,06817,04820,028
7 13,44317,04820,65324,258
8 15,79820,02824,25828,488
66 64,00478,22692,448
7 78,22695,573112,920
8 92,448112,920133,392
77 443,833527,452
8 527,452626,696
88 2,951,832
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.

Share and Cite

MDPI and ACS Style

Rochanakul, P.; Yingtaweesittikul, H.; Panma, S. Formulas for the Number of Weak Homomorphisms from Paths to Rectangular Grid Graphs. Symmetry 2025, 17, 497. https://doi.org/10.3390/sym17040497

AMA Style

Rochanakul P, Yingtaweesittikul H, Panma S. Formulas for the Number of Weak Homomorphisms from Paths to Rectangular Grid Graphs. Symmetry. 2025; 17(4):497. https://doi.org/10.3390/sym17040497

Chicago/Turabian Style

Rochanakul, Penying, Hatairat Yingtaweesittikul, and Sayan Panma. 2025. "Formulas for the Number of Weak Homomorphisms from Paths to Rectangular Grid Graphs" Symmetry 17, no. 4: 497. https://doi.org/10.3390/sym17040497

APA Style

Rochanakul, P., Yingtaweesittikul, H., & Panma, S. (2025). Formulas for the Number of Weak Homomorphisms from Paths to Rectangular Grid Graphs. Symmetry, 17(4), 497. https://doi.org/10.3390/sym17040497

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop