#### Abstract

Let be a graph having the set of edges . Represent by the degree of a vertex of . The Sombor (SO) index of is defined as . The length of a shortest cycle in a graph is known as the girth of . A connected graph with the same order and size is usually referred to as a (connected) unicyclic graph. This paper reports the characterization of the graphs possessing the first-two maximum values of the SO index in the class of all (connected) unicyclic graphs with a fixed girth and order.

#### 1. Introduction

In this paper, we are concerned with only connected and finite graphs. Thus, throughout this study, the term “graph” means a connected and finite graph. The graph-theoretical terminology utilized in this work without giving their definitions may be found in the books [1–3].

For a graph , represent by and the sets of edges and vertices, respectively. For a vertex , the set consists of all those vertices of that are adjacent with . The degree of a vertex is represented by , which is equal to the number of elements of the set . If , then is called a pendent vertex, and if , then is called a branching vertex. Denote by the graph deduced from by removing the vertex as well as its incident edges. The length of a shortest cycle in a graph is known as the girth of . A connected graph with the same order and size is usually referred to as a unicyclic graph. In other words, a connected cyclic graph having cyclomatic number one is known as a unicyclic graph [4].

The Sombor (SO) index for a graph is defined [5] as

The SO index, although proposed recently [5], has received a lot of attention from academics and led to numerous articles; for instance, see the surveys [6, 7] and associated references are given therein. Possible chemical applications of the SO index may be found in the papers [8, 9].

In the present article, we are concerned with the solution to an extremal problem involving the SO index for unicyclic graphs with a fixed girth and order. The SO index of unicyclic graphs has been studied in several papers. The graphs possessing the least and largest values of the SO index among all unicyclic graphs with a fixed order were found independently in [10, 11]. Liu [12] (respectively, Alidadi et al. [13]) reported the graphs attained the highest value (respectively, least value) of the SO index among all unicyclic graphs with a fixed diameter and order. The graphs attaining the minimum (respectively, maximum) SO index over the class of all unicyclic graphs with a fixed maximum degree (respectively, matching number) and order were characterized in [14] (respectively, in [15]). In this paper, we give the characterization of the graphs possessing the first-two maximum values of the SO index in the class of all unicyclic graphs with a fixed girth and order.

#### 2. Main Results

We start this section with an elementary lemma.

Lemma 1. *For and , the function defined byis strictly decreasing.*

Next, we provide a lemma that is crucial for proving our first main result.

Lemma 2. *Let be a connected graph of order at least 4. Let and be adjacent vertices of degrees at least 2 such that they do not have any neighbor in common. Let be the graph deduced from by dropping all the edges, except , incident with and inserting the edges for all . Then, .*

*Proof. *If , where , thenas desired.

The next result gives the characterization of the graphs possessing the first maximum value of the SO index in the class of all unicyclic graphs with a fixed girth and order.

Theorem 1. *If is a unicyclic graph with order and girth , thenwith equality if and only if , where is the graph formed by attaching pendent vertex/vertices to exactly one vertex of the cycle graph of order .*

*Proof. *In [11], it was proved that is the unique graph having the maximum Sombor index among all unicyclic graphs of order ; thus, our theorem follows from this result when . In the rest of the proof, we assume that . Also, suppose that is as large as possible. By Lemma 2, every vertex that lies on the cycle of has exactly two nonpendent neighbors. Note that can be written in terms of ; that is, . Now, we apply induction on . The result trivially holds for , because there is only one graph in either of these two cases. Thence, the induction starts. Let be a pendent vertex having the neighbor . Take with for each and . Note that and that exactly two members of are nonpendent. Observe that the graph has order and girth .

By Lemma 1, one haswhere the equality sign in (5) holds if and only if each of the two nonpendent neighbors of has degree 2. Note that the function defined byis strictly increasing for because its derivativeis positive for as the inequalitieshold for . Recall that . Consequently, it holds thatand hence, from (6), it follows thatwith equality if and only if each of the two nonpendent neighbors of has degree 2 and . Now, by using the inductive hypothesis in (11), one arrives atwith equality if and only if each of the two nonpendent neighbors of has degree 2, , and . This completes the induction and thence the proof.

In order to prove our second main result, which gives the characterization of the graphs possessing the second-maximum value of the SO index in the class of all unicyclic graphs with a fixed girth and order, we prove a series of lemmas.

Lemma 3. *Let be a connected graph of order at least 5. Let be an edge of such that each of its end vertices (i) has exactly two nonpendent neighbors and (ii) contains at least one pendent neighbor provided that . Let be the graph obtained from by removing all the pendent neighbors of and then attaching them to the vertex . It holds that .*

*Proof. *Let be the set of nonpendent neighbors of with . Let be the set of nonpendent neighbors of with . Also, assume that and . Then, .By Lemma 1, it holds thatand hence, (13) yields

Lemma 4. *Let be a connected graph of order at least 5. Let be an edge of such that each of its end vertices (i) has at least one pendent neighbor and (ii) contains exactly two nonpendent neighbors such that one of them has degree 2 and . (It is possible that the vertices and have a common neighbor.) Let be the graph obtained from by removing a pendent neighbor of and then attaching it to . It holds that .*

*Proof. *Let and . Then, . Here, one has

Lemma 5. *Let be a connected graph of order at least 6. Let and be nonadjacent vertices of such that each of them (i) has at least one pendent neighbor and (ii) contains exactly two nonpendent neighbors such that each of them has degree 2 and . Let be the graph obtained from by removing a pendent neighbor of and then attaching it to . It holds that .*

*Proof. *If and , then , and hence, we have

Lemma 6. *Let be the graph deduced from the cycle of order by attaching pendent vertices to a vertex and attaching pendent vertices to another vertex of , where and .*(i)*If , then* *with equality if and only if .*(ii)*If , then**with equality if and only if and .*

*Proof. *(i)This part follows directly from Lemma 4 because when .(ii)If , then the desired conclusion follows from Lemma 5. In the rest of the proof, assume that . By Lemma 4, we havewith equality if and only if . LetHere, it holds thatTaking , we havefor .

Lemma 7. *For and , if is the graph deduced from the unicyclic graph (see Theorem 1) by attaching pendent vertices to exactly one pendent vertex of , thenwith equality if and only if .*

*Proof. *The result trivially holds for because there is only one graph in this case. Thus, we suppose that . Here, we haveThe substitution in equation (25) yieldswhere . By a computer program, it is checked that the maximum value of the right-hand-sided expression of (26) under the given constraints is achieved if and only if .

Now, we determine the graph attaining the second-maximum value of the Sombor index in the class of all unicyclic graphs with a fixed order and girth.

Theorem 2. *Let be a unicyclic graph with order and girth such that (see Theorem 1).*(i)*If , then* *with equality if and only if is the graph deduced from by attaching a pendent vertex to one of its vertices of degree 2.*(ii)*If , then**with equality if and only if is a graph deduced from by attaching a pendent vertex to a vertex , where and is not adjacent to the branching neighbor.*

*Proof. *Suppose that is the unique cycle of . Letwhen .

If the set contains at least three branching vertices, then by using Lemmas 2, 3 (or 5), and 6, we find a unicyclic graph with order and girth such that and satisfying .

If the set contains exactly two branching vertices, then by using Lemmas 2, 4 (or 5), and 6, we find a unicyclic graph with order and girth such that and satisfying , where both the equality signs hold if and only if is one of the two extremal graphs defined in the statement of the theorem.

In the remaining proof, we assume that contains exactly one branching vertex; let be the branching vertex. Since , the vertex has at least three nonpendent neighbors. If has either at least four nonpendent neighbors or it has only three nonpendent neighbors, each of which has at least two nonpendent neighbor, then by using Lemmas 2 and 7, we find a unicyclic graph with order and girth such that and satisfying , where is the upper bound on given in Lemma 7, that is,At the end of the proof, we will prove that .

If has only three nonpendent neighbors such that one of them has only one nonpendent neighbor, then from Lemma 7, it follows that with equality if and only if .

In order to complete the proof, in the following, we prove that . First, we assume that . Then,Now, we suppose that . Then,for .

#### Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

This research has been funded by the Scientific Research Deanship, University of Hail–Saudi Arabia through project number RG-22005.