Next Article in Journal
Ranking the Importance of Variables in a Nonparametric Frontier Analysis Using Unsupervised Machine Learning Techniques
Next Article in Special Issue
The Longest (s, t)-Path Problem on O-Shaped Supergrid Graphs
Previous Article in Journal
On Reusing the Stages of a Rejected Runge-Kutta Step
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An Algorithm for the Numbers of Homomorphisms from Paths to Rectangular Grid Graphs

by
Hatairat Yingtaweesittikul
,
Sayan Panma
and
Penying Rochanakul
*
Department of Mathematics, Faculty of Science, Chiang Mai University, Chiang Mai 50200, Thailand
*
Author to whom correspondence should be addressed.
Mathematics 2023, 11(11), 2587; https://doi.org/10.3390/math11112587
Submission received: 1 April 2023 / Revised: 1 June 2023 / Accepted: 2 June 2023 / Published: 5 June 2023
(This article belongs to the Special Issue Graph Theory: Advanced Algorithms and Applications)

Abstract

:
Let G and H be graphs. A mapping f from the vertices of G to the vertices of H is known as a h o m o m o r p h i s m from G to H if, for every pair of adjacent vertices x and y in G, the vertices f ( x ) and f ( y ) are adjacent in H. A rectangular grid graph is the Cartesian product of two path graphs. In this paper, we provide a formula to determine the number of homomorphisms from paths to rectangular grid graphs. This formula gives the solution to the problem concerning the number of walks in the rectangular grid graphs.
MSC:
20M10; 05C25; 05C76; 05C85

1. Introduction

In mathematics, the image is the set of the values of a mapping at all elements in the domain. In such an image, some structures of the domain are preserved. A  mapping that preserves a structure, the one that we need to study, is usually known as a homomorphism. For graphs, a homomorphism is defined as follows.
Throughout this paper, all graphs are finite and simple, and we denote the vertex set and the edge set of a graph G by V ( G ) and E ( G ) , respectively. Let G and H be two graphs. A mapping f from V ( G ) to V ( H ) is known as a h o m o m o r p h i s m from G to H if { f ( x ) , f ( y ) } E ( H ) for all { x , y } E ( G ) . When G = H , f is an e n d o m o r p h i s m on G. The composition of homomorphisms is also known as a homomorphism. This leads to a preorder on graphs and a category [1]. We use the symbol Hom( G , H ) to denote the set of all homomorphisms from G to H and End(G) to denote the set of all endomorphisms on G.
In a simple graph, a  w a l k is a sequence of consecutive adjacent vertices. A  p a t h is a walk in which no vertex is repeated. We shall also use the word ‘path’ to denote a graph where the first and the last vertices have a degree one, and the other vertices have a degree two. Here, P n stands for a path of order n with V ( P n ) = { 0 , 1 , . . . , n 1 } and E ( P n ) = { { i , i + 1 } i = 0 , 1 , . . . , n 2 } . Let us denote the path P n with an edge-labeling ϕ by P n ϕ . Furthermore, refer to [1,2] for more basic definitions and results regarding graphs and algebraic graphs.
The formula for the number of endomomorphisms on P n , |End( P n )|, was introduced by Arworn [3] in 2009. This number is calculated by the summation of the numbers of shortest paths from point ( 0 , 0 ) to any point ( i , j ) in a square lattice and an r-ladder square lattice. Moreover, in the same year, Arworn and Wojtylak [4] proposed a formula for the number of homomorphisms from P m to P n , | Hom ( P m , P n )|, in terms of | 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 2012, Lina and Zeng [5] constructed another formula for | Hom ( P m , P n )|, which was obtained by proving the conjecture in [6]. In 2014, Eggleton and Morayne [7] also gave another formula for | Hom ( P m , P n )|. Moreover, they considered finite Laurent series to be generating functions that can move homomorphisms of a finite path into any path, finite or infinite.
In 2018, Knauer and Pipattanajinda [8] studied a generalization of path endomorphisms, namely weak path endomorphisms. The number of weak path endomorphisms is calculated by the summation of the numbers of shortest paths from point ( 0 , 0 , 0 ) to any point ( i , j , k ) in a cubic lattice and in an r-ladder cubic lattice. Recently, in 2022, Pomsri et al. [9] proposed a formula for the number of weak homomorphisms from P m to P n in recursive form.
The Cartesian product  G × H of the graphs G and H is a graph with V ( G × H ) = V ( G ) × V ( H ) and E ( G × H ) = { { ( a , b ) , ( a , c ) } a V ( G ) , { b , c } E ( H ) } { { ( a , b ) , ( d , b ) } { a , d } E ( G ) , b V ( H ) } . A rectangular grid graph or an m × n grid graph is the Cartesian product of two path graphs on m and n vertices. There is one-to-one correspondence between the set of homomorphisms f : P n   G 1 G 2 and the set of walks of n vertices in G 1 G 2 . Thus, the number of homomorphisms from a path P n to a grid graph gives the number of walks of n vertices in the rectangular grid graph.
In 2023, Keshavarz-Kohjerdi and Bagheri [10] studied a rectangular grid graph in which some rectangles are removed from its corners, namely a truncated rectangular grid graph. They provided a linear-time algorithm for finding a Hamiltonian cycle problem in a truncated rectangular grid graph. These could be extended to the lower bound for the number of homomorphisms from a cycle to a rectangular grid graph.
Our purpose is to find a formula for the number of homomorphisms from a path P m to another path P n and to a rectangular grid graph P n P k .

2. The Number of Homomorphisms from Paths to Paths with f(0) = j

In this section, we provide the formula for finding the number of homomorphisms from paths P m to P n , which maps 0 to j. We denote the set of homomorphisms from P m to P n , which maps 0 to j, by  Hom j ( P m , P n ) .
For 0 j n 1 , let
Hom j ( P m , P n ) = { f Hom ( P m , P n ) f ( 0 ) = j } .
By the symmetry of P n , we obtain the following lemma:
Lemma 1. 
Let j and n be integers such that 0 j < n .
| Hom j ( P m , P n ) | = | Hom ( n j 1 ) ( P m , P n ) | .
Here, we transform the cardinal number of | Hom j ( P m , P n ) | to count the shortest paths on square lattices. Figure 1a–c show the possible homomorphisms from P 4 to P 5 , which map 0 to 0, 1, and 2, respectively. The numbers on the top are elements of the domain set V ( P 4 ) , and the tuples on the left are elements of the image set V ( P 5 ) . These become square lattices, as shown in Figure 2a–c after rotating 45 counterclockwise.
Each homomorphism f Hom ( P m , P n ) | can be visualized using the square lattice, where movement from ( i , j ) to the next point is depicted as follows:
  • To ( i + 1 , j ) if f ( x + 1 ) = f ( x ) + 1 .
  • To ( i , j + 1 ) , if  f ( x + 1 ) = f ( x ) 1 .
For example, if the images of successive vertices of f | Hom 3 ( P 17 , P 10 ) | are 3 , 4 , 5 , 4 , 5 , 4 , 3 , 2 , 1 , 0 , 1 , 2 , 3 , 2 , 3 , 4 and 5, then the homomorphism can be visualized as shown in Figure 3.
In general, | Hom j ( P m , P n ) | can be obtained from the number of shortest paths from ( 0 , 0 ) to any point ( i , n i 1 ) on the square lattice that stays between the lines y = x + j and y = x n + j + 1 , where touching is allowed.
Lemma 2 
([5]). The number of shortest paths from point ( 0 , 0 ) to any point ( i , n i 1 ) on the square lattice that stays between the lines y = x + j and y = x ( n j 1 ) is
| t | ( m + n ) / n m 1 i t ( n + 1 ) m 1 i + j t ( n + 1 ) + 1 .
where n k = 0 if k > n or k < 0 .
Hence, we obtain the following theorem.
Theorem 1. 
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
Example 1. 
Using Theorem 1, we have
| Hom 0 ( P 4 , P 5 ) | = i = 2 3 t = 1 1 3 i 6 t 3 i 6 t + 1 = i = 2 3 3 i + 6 3 i + 7 + 3 i 3 i + 1 + 3 i 6 3 i 5 = 3 2 3 3 + 3 3 = 3 ,
| Hom 1 ( P 4 , P 5 ) | = i = 1 3 t = 1 1 3 i 6 t 3 i 6 t + 2 = i = 1 3 3 i + 6 3 i + 8 + 3 i 3 i + 2 + 3 i 6 3 i 4 = 3 1 3 3 + 3 2 + 3 3 = 6 ,
and
| Hom 2 ( P 4 , P 5 ) | = i = 1 2 t = 1 1 3 i 6 t 3 i 6 t + 3 = i = 1 2 3 i + 6 3 i + 9 + 3 i 3 i + 3 + 3 i 6 3 i 3 = 3 1 + 3 2 = 6 .
which is in line with counting directly from Figure 2. By counting the paths in Figure 2a, we have | Hom 0 ( P 4 , P 5 ) | = 3 (see Figure 4). By counting the paths in Figure 2b, we have | Hom 1 ( P 4 , P 5 ) | = 6 (see Figure 5). By counting the paths in Figure 2c, we have | Hom 2 ( P 4 , P 5 ) | = 6 . (see Figure 6).
For convenience, we compute | Hom j ( P m , P n ) | for 2 m , n 9 (Table 1).

3. The Number of Homomorphisms from Paths to Rectangular Grid Graphs

In this section, we provide the formulas for finding the number of homomorphisms from paths P m to rectangular grid graphs P n P k . We denote the set of homomorphisms from P m to P n P k , which maps 0 to ( i , j ) , by  Hom i j ( P m , P n P k ) .
For 0 i n 1 , 0 j k 1 , let
Hom i j ( P m , P n P k ) = { f Hom ( P m , P n P k ) f ( 0 ) = ( i , j ) } .
From the symmetry of P n P k , we obtain the following lemma:
Lemma 3. 
Let i and n be integers such that 0 j < n , and let m > 2 be a positive integer.
(1) 
| Hom i j ( P m , P n P k ) | = | Hom ( n i 1 ) j ( P m , P n P k ) | = | Hom i ( k j 1 ) ( P m , P n P k ) |
                         = | Hom ( 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) 
| Hom ( P m , P 2 n P 2 k ) | = 4 i = 0 n 1 j = 0 k 1 | Hom i j ( P m , P 2 n P 2 k ) | .
(3) 
| Hom ( P m , P 2 n + 1 P 2 k ) | = 4 i = 0 n 1 j = 0 k 1 | Hom i j ( P m , P 2 n + 1 P 2 k ) |
                                + 2 j = 0 k 1 | Hom n j ( P m , P 2 n + 1 P 2 k ) | .
(4) 
| Hom ( P m , P 2 n P 2 k + 1 ) | = 4 i = 0 n 1 j = 0 k 1 | Hom i j ( P m , P 2 n P 2 k + 1 ) |
                                + 2 i = 0 n 1 | Hom i k ( P m , P 2 n P 2 k + 1 ) | .
(5) 
| Hom ( P m , P 2 n + 1 P 2 k + 1 ) | = 4 i = 0 n 1 j = 0 k 1 | Hom i j ( P m , P 2 n + 1 P 2 k + 1 ) |
                                     + 2 j = 0 k 1 | Hom n j ( P m , P 2 n + 1 P 2 k + 1 ) |
                                     + 2 i = 0 n 1 | Hom i k ( P m , P 2 n + 1 P 2 k + 1 ) |
                                     + | Hom n k ( P m , P 2 n + 1 P 2 k + 1 ) | .
To prove the main theorem, we define a new operation for two paths with their edge labelings.
Definition 1. 
Let P m ϕ , P n ψ be paths P m , P n with edge labelings ϕ and ψ. Define P m ϕ and P n ψ  entwined or P m ϕ P n ψ as the set of all paths P m + n 1 with edge labels from ϕ and ψ that preserve the sequential order of ϕ and ψ.
Example 2. 
Consider paths P 4 and P 3 with injective edge labelings ϕ and ψ, as shown below.
Mathematics 11 02587 i001
This leads to the following lemma:
Lemma 4. 
Let P m ϕ , P n ψ be paths with edge labelings. Then,
| P m P n | = m + n 2 m 1 .
Proof. 
It is easy to see that the number of ways to label P m + n 1 is equal to the permutations of all m + n 2 edge labels with a fixed sequential order.    □
Next, we observe a simple example to visualize homomorphisms from paths to rectangular grid graphs on a square lattice.
Example 3 
( Hom 00 ( P 4 , P 4 P 5 ) = 18 ). All possible homomorphisms f Hom 00 ( P 4 , P 4 P 5 ) are shown in Figure 7. The numbers on the top are elements of the domain set V ( P 4 ) , and the tuples on the left are elements of the image set V ( P 4 P 5 ) . The tuples with the same second elements are represented by circles of the same color.
The mappings f 1 , f 2 Hom 00 ( P 4 , P 4 P 5 ) with f 1 ( 0 ) = ( 0 , 0 ) , f 1 ( 1 ) = ( 0 , 1 ) , f 1 ( 2 ) = ( 0 , 2 ) , f 1 ( 3 ) = ( 0 , 1 ) and f 2 ( 0 ) = ( 0 , 0 ) , f 2 ( 1 ) = ( 1 , 0 ) , f 2 ( 2 ) = ( 2 , 0 ) , f 2 ( 3 ) = ( 1 , 0 ) are represented by the red lines on the top and the black lines (see Figure 8). We note that the normal black lines represent the increment of the first coordinate, the dashed black lines represent the decrement of the first coordinate, the normal red lines represent the increment of the second coordinate, and the red lines represent the decrement of the second coordinate.
We now divide all mappings in Hom 00 ( P 4 , P 4 P 5 ) into groups according to the number of change occurrences in the first coordinate h and rewrite each path as entwined black and red paths.Mathematics 11 02587 i002
For each h { 0 , 1 , 2 , 3 } , observe that out of the 3 edges of P 4 from P h + 1 P 4 h , there are 3 h ways to place h edges from the black path and one way to place 3 h edges from the red path. Moreover, the black line P h + 1 is the square lattice representation of f 1 Hom 0 ( P h + 1 , P 4 ) , while the red line P 4 h is the square lattice representation of f 2 Hom 0 ( P 4 h , P 5 ) . Thus, there are 3 h | Hom 0 ( P h + 1 , P 4 ) | | Hom 0 ( P 4 h , P 5 ) | possible paths in P h + 1 P 4 h . Hence,
   
| Hom 00 ( P 4 , P 4 P 5 ) | = 3 0 | Hom 0 ( P 1 , P 4 ) | | Hom 0 ( P 4 , P 5 ) | + 3 1 | Hom 0 ( P 2 , P 4 ) | | Hom 0 ( P 3 , P 5 ) | + 3 2 | Hom 0 ( P 3 , P 4 ) | | Hom 0 ( P 2 , P 5 ) | + 3 3 | Hom 0 ( P 4 , P 4 ) | Hom 0 ( P 1 , P 5 ) | = 1 ( 1 ) ( 3 ) + 3 ( 1 ) ( 2 ) + 3 ( 2 ) ( 1 ) + 1 ( 3 ) ( 1 ) = 18 .
Example 4 
( | Hom 11 ( P 4 , P 4 P 5 ) | = 47 ). All possible homomorphisms f Hom 11 ( P 4 , P 4 P 5 ) are shown in Figure 9. The numbers on the top are elements of the domain set V ( P 4 ) , and the tuples on the left are elements of the image set V ( P 4 P 5 ) . The tuples with the same second elements are represented by circles of the same color.
| Hom 11 ( P 4 , P 4 P 5 ) | = 3 0 | Hom 1 ( P 1 , P 4 ) | | Hom 1 ( P 4 , P 5 ) | + 3 1 | Hom 1 ( P 2 , P 4 ) | | Hom 1 ( P 3 , P 5 ) | + 3 2 | Hom 1 ( P 3 , P 4 ) | | Hom 1 ( P 2 , P 5 ) | + 3 3 | Hom 1 ( P 4 , P 4 ) | Hom 1 ( P 1 , P 5 ) | = 1 ( 1 ) ( 6 ) + 3 ( 2 ) ( 3 ) + 3 ( 3 ) ( 2 ) + 1 ( 5 ) ( 1 ) = 47 .
Lemma 5. 
Let m , n and k be positive integers and let i , j be non-negative integers, such that i < n 2 1 and j < k 2 1 . It follows that
| Hom i j ( P m , P n P k ) | = h = 0 m 1 m 1 h | Hom i ( P h + 1 , P n ) | | Hom j ( P m h , P k ) | .
Proof. 
Let f Hom 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 , 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 H o m i ( P h + 1 , P n ) . Similarly, the sequence of changes in the second coordinate form a homomorphism f 2 H o m i ( P m 1 h + 1 , P k ) . Thus, the corresponding path graph of f can be obtained from path graphs of f 1 and f 2 entwined. Hence, | Hom i j ( P m , P n P k ) | = h = 0 m 1 m 1 h | Hom i ( P h + 1 , P n ) | | Hom j ( P m h , P k ) | .    □
From Theorem 1, Lemma 3 and Lemma 5, we get the theorem below.
Theorem 2. 
Let m , n and k be positive integers. The cardinalities | Hom ( P m , P n P k ) | of homomorphisms from paths P m to rectangular grid graphs P n P k are
| Hom ( P m , P n P k ) | = 4 i = 0 n / 2 1 j = 0 k / 2 1 | Hom i j ( P m , P n P k ) |
                                  + ( 1 ( 1 ) n ) j = 0 k / 2 1 | Hom n / 2 j ( P m , P n P k ) |
                                  + ( 1 ( 1 ) k ) i = 0 n / 2 1 | Hom i k / 2 ( P m , P n P k ) |
                                  + ( 1 / 4 ) ( 1 ( 1 ) n ) ( 1 ( 1 ) k ) | Hom n / 2 k / 2 ( P m , P n P k ) |
where | Hom i j ( P m , P n P k ) | = h = 0 m 1 m 1 h | Hom i ( P h + 1 , P n ) | | Hom j ( P m h , P k ) | and
| 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 ,
where L = max { 0 , m j 1 2 } and U = min { m 1 , m + n j 2 2 } .
For convenience, we compute | Hom ( P m , P n P k ) | for 2 m , n , k 8 . The results are presented in Table 2.

4. The Algorithm

In this section, we provide algorithms used to calculate | Hom i ( P m , P n ) | ,
| Hom i j ( P m , P n P k ) | and | Hom ( P m , P n P k ) | with the aforementioned theorems.
Algorithms 1–3 are implementations of Theorem 1, Lemma 5 and Theorem 2, respectively.
Algorithm 1LocalPath2Path: Number of Homomorphisms from P m to P n with f ( 0 ) = j
Input:
- m: the size of the domain
- n: the size of the range
- Fixed value j where f ( 0 ) = j (with 0 j n 1 )
Output: number of homomorphisms from P m to P n with f ( 0 ) = j
  • L max { 0 , m j 1 2 }
  • U min { m 1 , m + n j 2 2 }
  • if L > U then
  •     return 0
  • end if
  • h o m j 0
  • for i = L to U  do
  •     for  t = m + n n to m + n n  do
  •          h o m j h o m j + m 1 i t ( n + 1 ) m 1 i + j t ( n + 1 ) + 1
  •     end for
  • end for
  • return  h o m j
Algorithm 2LocalPath2Grid: Number of Homomorphisms from P m to P n P k with f ( 0 ) = ( i , j )
Input:
- m: the size of the domain
- n , k : the dimensions of the grid representing the range
- Fixed value i , j where f ( 0 ) = ( i , j ) (with 0 i n 1 and 0 j k 1 )
Output: number of homomorphisms from P m to P n P k with f ( 0 ) = ( i , j )
  • h o m i j 0
  • for h = 0 to m 1  do
  •      c i L o c a l P a t h 2 P a t h ( h + 1 , n , i )
  •      c j L o c a l P a t h 2 P a t h ( m h , k , j )
  •      h o m i j h o m i j + m 1 h c i c j
  • end for
  • return homij
Algorithm 3Path2Grid: Number of Homomorphisms from P m to P n P k
Input:
- m: the size of the domain
- n , k : the dimensions of the grid representing the range
Output: number of homomorphisms from P m to P n P k
  • h o m g r i d 0
  • s u m 0
  • for i = 0 to n / 2 1  do
  •     for  j = 0 to k / 2 1  do
  •          s u m s u m + L o c a l P a t h 2 G r i d ( m , n , k , i , j )
  •     end for
  • end for
  • h o m g r i d h o m g r i d + s u m 4
  • s u m 0
  • for j = 0 to k / 2 1  do
  •      s u m s u m + L o c a l P a t h 2 G r i d ( m , n , k , n / 2 , j )
  • end for
  • h o m g r i d h o m g r i d + ( 1 ( 1 ) n ) s u m
  • s u m 0
  • for i = 0 to n / 2 1  do
  •      s u m s u m + L o c a l P a t h 2 G r i d ( m , n , k , i , k / 2 )
  • end for
  • h o m g r i d h o m g r i d + ( 1 ( 1 ) k ) s u m
  • h o m g r i d h o m g r i d + 1 4 ( 1 ( 1 ) n ) ( 1 ( 1 ) k ) L o c a l P a t h 2 G r i d ( m , n , k , n / 2 , k / 2 )
  • return  h o m g r i d
Lemma 6. 
Algorithm P a t h 2 G r i d has time-complexity O ( n · m · k · max ( n , m , k ) ) .
Proof. 
It is easy to see that the complexity of the algorithm depends on the first loop, which is also nested with O ( n · k ) rounds. Each round consists of an execution of LOCALPATH2GRID, which is essentially a loop with O ( m ) rounds. Each of these deeper rounds calls LOCALPATH2PATH twice.
To see the runtime for LOCALPATH2PATH given parameters m and n, we first see the complexity of the outer loop:
O ( U L ) = O min m 1 , m 1 m j 1 2 , m + n j 2 2 , m + n j 2 2 m j 1 2 O min m , m + n , n = O ( min { m , n } )
Then, we consider the following scenarios:
  • m < n : In this case ( m + n ) / n = 1 ; hence, the inner loop has fixed rounds. Therefore, the complexity is at most O ( min { m , n } ) .
  • m > = n : In this case, the complexity of the inner loop is O ( ( m + n ) / n ) . Together, we have the overall complexity:
    O ( min { m , n } ) O ( ( m + n ) / n ) = O ( n ) O ( ( m + n ) / n ) O ( n ) O ( m / n ) O ( m )
Therefore, the overall complexity of LOCALPATH2PATH is O ( min { m , n } ) . Since each round of LOCALPATH2GRID calls LOCALPATH2PATH twice, respectively with parameters ( h + 1 , n ) and ( m h , k ) , we have its complexity as:
O ( min { h + 1 , n } ) + O ( min { m h , k } ) O ( min { m , n } ) + O ( min { m , k } ) O ( max { m , n } ) + O ( max { m , k } ) O ( max { m , n , k } )
Together, the total complexity of PATH2GRID is O ( m · n · k · max { m , n , k } ) . □

Author Contributions

Conceptualization, S.P.; methodology, S.P.; software, H.Y.; validation, H.Y.; investigation, P.R.; writing—original draft, P.R.; writing—review and editing, H.Y. and S.P.; visualization, H.Y. and P.R.; project administration, S.P.; funding acquisition, 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 sharing not applicable.

Acknowledgments

We thank the reviewers for their insightful comments and suggestions that improved the quality of our manuscript. We wish to express our thanks to Pham Hoang Viet for several helpful comments concerning algorithm analyzing. This research was supported by Faculty of Science, Chiang Mai University, and Chiang Mai University, Thailand.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Hell, P.; Nestril, J. Graphs and Homomorphisms; Oxford University Press: Oxford, UK, 2004. [Google Scholar]
  2. Knauer, U.; Knauer, K. Algebraic Graph Theory: Morphisms, Monoids and Matrices; Walter de Gruyter: Berlin, Germany, 2011. [Google Scholar]
  3. Arworn, S. An algorithm for the numbers of endomorphisms on paths. Discret. Math. 2009, 309, 94–103. [Google Scholar] [CrossRef] [Green Version]
  4. Arworn, S.; Wojtylak, P. An algorithm for the number of path homomorphisms. Discret. Math. 2009, 309, 5569–5573. [Google Scholar] [CrossRef] [Green Version]
  5. Lina, Z.; Zeng, J. On the number of congruence classes of paths. Discret. Math. 2012, 312, 1300–1307. [Google Scholar] [CrossRef] [Green Version]
  6. Michels, M.A.; Knauer, U.H. The congruence classes of paths and cycles. Discret. Math. 2009, 309, 5352–5359. [Google Scholar] [CrossRef] [Green Version]
  7. Eggleton, R.B.; Morayne, M. A Note on Counting Homomorphisms of Paths. Graphs Comb. 2014, 30, 159–170. [Google Scholar] [CrossRef] [Green Version]
  8. Knauer, U.; Pipattanajinda, N. A formula for the number of weak endomorphisms on paths. Algebra Discret. Math. 2018, 26, 270–279. [Google Scholar]
  9. Pomsri, T.; Wannasit, W.; Panma, S. Finding the Number of Weak Homomorphisms of Paths. J. Math. 2022, 2022, 2153927. [Google Scholar] [CrossRef]
  10. Keshavarz-Kohjerdi, F.; Bagheri, A. Finding Hamiltonian cycles of truncated rectangular grid graphs in linear time. Appl. Math. Comput. 2023, 436, 127513. [Google Scholar] [CrossRef]
Figure 1. Graphical presentation of the domain and image of all possible homomorphisms f Hom ( P 4 , P 5 ) . (a) f ( 0 ) = 0 . (b) f ( 0 ) = 1 . (c) f ( 0 ) = 2 .
Figure 1. Graphical presentation of the domain and image of all possible homomorphisms f Hom ( P 4 , P 5 ) . (a) f ( 0 ) = 0 . (b) f ( 0 ) = 1 . (c) f ( 0 ) = 2 .
Mathematics 11 02587 g001
Figure 2. Square lattice presentations of all possible homomorphisms f Hom ( P 4 , P 5 ) . (a) f ( 0 ) = 0 . (b) f ( 0 ) = 1 . (c) f ( 0 ) = 2 .
Figure 2. Square lattice presentations of all possible homomorphisms f Hom ( P 4 , P 5 ) . (a) f ( 0 ) = 0 . (b) f ( 0 ) = 1 . (c) f ( 0 ) = 2 .
Mathematics 11 02587 g002
Figure 3. The shortest path from (0, 0) to (9, 7) that stays between lines y = x + j and y = x n + j + 1 , where j = 3 , m = 17 and n = 10 .
Figure 3. The shortest path from (0, 0) to (9, 7) that stays between lines y = x + j and y = x n + j + 1 , where j = 3 , m = 17 and n = 10 .
Mathematics 11 02587 g003
Figure 4. All possible presentations of homomorphisms f Hom 0 ( P 4 , P 5 ) on a square lattice.
Figure 4. All possible presentations of homomorphisms f Hom 0 ( P 4 , P 5 ) on a square lattice.
Mathematics 11 02587 g004
Figure 5. All possible presentations of homomorphisms f Hom 1 ( P 4 , P 5 ) on a square lattice.
Figure 5. All possible presentations of homomorphisms f Hom 1 ( P 4 , P 5 ) on a square lattice.
Mathematics 11 02587 g005
Figure 6. All possible presentations of homomorphisms f Hom 2 ( P 4 , P 5 ) on a square lattice.
Figure 6. All possible presentations of homomorphisms f Hom 2 ( P 4 , P 5 ) on a square lattice.
Mathematics 11 02587 g006
Figure 7. Graphical presentation of the domain and image of all possible homomorphisms f Hom 00 ( P 4 , P 4 P 5 ) .
Figure 7. Graphical presentation of the domain and image of all possible homomorphisms f Hom 00 ( P 4 , P 4 P 5 ) .
Mathematics 11 02587 g007
Figure 8. Square lattice presentation of f 1 and f 2 .
Figure 8. Square lattice presentation of f 1 and f 2 .
Mathematics 11 02587 g008
Figure 9. Graphical presentation of the domain and image of all possible homomorphisms f Hom 11 ( P 4 , P 4 P 5 ) .
Figure 9. Graphical presentation of the domain and image of all possible homomorphisms f Hom 11 ( P 4 , P 4 P 5 ) .
Mathematics 11 02587 g009
Table 1. Numbers of homomorphisms f Hom j ( P m , P n ) for 2 m , n 9 .
Table 1. Numbers of homomorphisms f Hom j ( P m , P n ) for 2 m , n 9 .
n
m j 2345678
201111111
11222222
20122222
30012222
301222222
11233333
20234444
30023444
401233333
11256666
20256777
30036788
501456666
11489101010
204812131414
30059131415
601489101010
1181318192020
2041318232425
300818232829
70181318192020
1182127333435
2082136424849
3001327424854
80182127333435
11163454616869
2083454758289
30021547596103
Table 2. Numbers of homomorphisms f ( P m , P n P k ) for 2 m n , k 8 .
Table 2. Numbers of homomorphisms f ( P m , P n P k ) for 2 m n , k 8 .
k
m n 2345678
228142026323844
314243444546474
4203448627690104
52644628098116134
632547698120142164
7386490116142168194
84474104134164194224
333468102136170204238
452102152202252302352
570136202268334400466
688170252334416498580
7106204302400498596694
8124238352466580694808
4413630848866884810281208
5190424668912115614001644
62445408481156146417722080
729865610281400177221442516
835277212081644208025162952
55518133022263132403849445850
6680172628764038520063627524
7842212235264944636277809198
810042518417658507524919810872
6619005528978814172185682296427360
7238668801213817544229642838433804
8287282321448820916273603380440248
77677422360418846245483196103952124708
8823226976503847502099856124708149560
882362888496175476269596365328461288557264
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

Yingtaweesittikul, H.; Panma, S.; Rochanakul, P. An Algorithm for the Numbers of Homomorphisms from Paths to Rectangular Grid Graphs. Mathematics 2023, 11, 2587. https://doi.org/10.3390/math11112587

AMA Style

Yingtaweesittikul H, Panma S, Rochanakul P. An Algorithm for the Numbers of Homomorphisms from Paths to Rectangular Grid Graphs. Mathematics. 2023; 11(11):2587. https://doi.org/10.3390/math11112587

Chicago/Turabian Style

Yingtaweesittikul, Hatairat, Sayan Panma, and Penying Rochanakul. 2023. "An Algorithm for the Numbers of Homomorphisms from Paths to Rectangular Grid Graphs" Mathematics 11, no. 11: 2587. https://doi.org/10.3390/math11112587

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