1. Introduction
A directed graph (or just a digraph) D consists of a nonempty finite set V of elements called vertices and a finite set E of ordered pairs of distinct vertices called arcs. Two vertices are called adjacent if they are connected by an arc. If there is an arc from vertex u to vertex v, we indicate this by writing . The in-degree (resp. out-degree) of a vertex v, denoted by  (resp. ) is the number of arcs of the form  (resp. ), where 
Directed graphs arise in a natural way in many applications of graph theory. Social networks are often modeled as directed graphs, representing networks with directionality such as social media interactions [
1]. The same occurs with transportation networks [
2]. Moreover, specific types of digraphs, such as derivable digraphs, are used in wireless sensor networking [
3].
The theory of VDB topological indices of graphs is a widely investigated topic in the mathematical and chemical literature [
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14]. The concept of a VDB topological index of a digraph was introduced in [
15] as a generalization of VDB topological indices of graphs. Namely, a VDB topological index over a set of digraphs 
 is a function 
, defined for each 
 as
      
      where 
 is an appropriate bivariate function which satisfies 
. In the mentioned paper, the Randić index of a digraph was obtained, and the extreme value problem of the Randić index over the set of oriented trees with 
n vertices was solved. More recent studies of the topic of VDB topological indices of digraphs can be found in [
16,
17,
18,
19,
20].
In this article, we introduce a new matrix approach to the concept of VDB topological index, where each of these indices is defined by a real matrix . Related to this definition, we introduce the concept of an affine subspace of a digraph providing a geometrical interpretation of the VDB topological index of a digraph.
In case the matrix 
 is symmetric, we recover the concept of the VDB topological index usually induced by symmetric real functions of two variables. However, by considering nonsymmetric matrices, we obtain an extension of this concept to nonsymmetric bivariate functions. This is the main difference with the concept of a VDB topological index of a digraph introduced in [
15], since it is based on a symmetric function. In 
Section 5, we study the general first Zagreb index over the set of orientations of a path. This index is an example of a VDB topological index induced by a nonsymmetric matrix.
Finally, we show that our approach can be used for some distance-based topological indices, such as the Szeged [
21] and the Mostar [
22] indices.
  2. Preliminaries
Given a digraph D with vertex set V and arc set E, we denote by  and  the maximal out-degree and maximal in-degree, respectively, among all vertices in D. A vertex v is called an isolated vertex if , a source vertex if , and a sink vertex if .
We say that D is an oriented graph if, whenever  then  An oriented graph D is obtained from a graph G by assigning a direction to each edge of G; D is called an orientation of G. An example of an orientation of a graph is the so-called sink-source orientation, in which every vertex is a sink vertex or a source vertex. On the other hand, we have balanced orientations of a graph, where the difference between the in-degree and out-degree of each vertex is at most 1.
Let us denote by  the set of digraphs with n non-isolated vertices.
Recall that a graph G can be identified with its symmetric digraph , where each edge in G is replaced by a pair of symmetric arcs in . Let us denote by  the set of graphs with n vertices. The theory of symmetric VDB topological indices over a set  has been studied extensively in the past decades. In fact, in this theory it is always assumed that  is induced by a symmetric bivariate function .
The space of  real matrices is denoted by . If , then  is the -entry of M. In this way,  is the trace of M. The transpose of M is denoted by . For each  we have the linear functional  defined as , for every .
  3. Affine Subspace of a Digraph
In this section, we introduce the matrix approach to the concept of the VDB topological index and define the affine subspace of a digraph.
Definition 1. Let  The maximal degree of  is the number  Let  with maximal degree p. We represent each graph  by the matrix , where  is the number of arcs  such that  and . In this way we have a representing function  of the set  into the space of matrices . On the other hand, fix a matrix  and consider the linear functional  defined as , for each 
Definition 2. The function  defined as  is called a VDB topological index defined over .
 Example 1. Let D denote the digraph depicted in Figure 1. The sequence of out-degrees of D is  while the sequence of in-degrees of D is . Consequently, D has maximal degree  and it is represented by a  matrix . Consider the matrix  whose -entry is given by The VDB topological index  of digraph D, denoted by , is obtained by the compositionand its value is  We next show that Definition 2 coincides with the definition of VDB topological index of digraphs given in ([
15], Definition 2.1), when matrix 
 is symmetric.
Lemma 1. Let  be a VDB topological index over the set  of degree p. If , thenwhere E is the set of arcs in H.  Example 2. Let  be the set of all orientations of the path  of n vertices. Clearly,  has maximal degree 2. Consequently, each  is represented by a  matrix  where  are real nonnegative numbers such thatConsider the matrix  whose -entry is given by Then we obtain the VDB topological index  as the compositionFor instance, consider the balanced orientation  of  given in Figure 2. Then clearly  and soOn the other hand, if n is even and  is a sink-source orientation of  (see Figure 2), then . If n is odd, then  and  are sink-source orientations of  (see Figure 2) with  and . In either case,where .  Let us assume that 
 is a VDB topological index over the set 
 of maximal degree 
p. Note that the kernel of 
, which we denote by 
, is a hyperspace of 
. In other words, 
 is a subspace of 
 of dimension 
. Furthermore, let us denote by 
 and 
 the upper and lower open halfspaces determined by 
:
      and
      
Definition 3. Let  be a VDB topological index over  of maximal degree p and  The affine subspace of  is denoted by  and defined asFurthermore, the affine upper and lower open halfspaces of  arerespectively.  In other words, each 
 divides the space of matrices 
 into two open halfspaces: 
 and 
 (see 
Figure 3).
Theorem 1. Let  be a VDB topological index over  of maximal degree p and . Given , the following conditions hold:
- 1. 
-  if and only if  
- 2. 
-  if and only if  
- 3. 
-  if and only if  
 Proof. 1. This is a consequence of the following equivalences: 
- 2.
- It follows from the equivalences
             
- 3.
- This is similar to the proof of 2. 
        □
 Definition 4. Let  be a VDB topological index over  of maximal degree p and  We say that  is maximal (resp. minimal) in  with respect to  if  (resp. ), for all 
 Corollary 1. Let  be a VDB topological index over  of maximal degree p and  Then:
- 1. 
-  is maximal in  with respect to  if and only if ; 
- 2. 
-  is minimal in  with respect to  if and only if . 
 Proof.  This is a direct consequence of Theorem 1.    □
 Example 3. Consider the VDB topological index  over  as described in Example 2, and  as defined in Example 2 (see Figure 2). ThenLet  with matrix representation  Thenand by (1),Hence,  and so by Corollary 1,  is maximal in  with respect to . Similarly, In either case by (1) and (2)Consequently,  and so by Corollary 1,  is minimal in  with respect to  for each . Compare with ([15], Theorem 5.1).    4. Symmetric VDB Topological Indices
We begin this section defining the concept of symmetric VDB topological indices.
Definition 5. Let  be a VDB topological index over  of maximal degree p. We say that  is a symmetric VDB topological index if φ is a symmetric matrix, i.e.,  Otherwise, we say that  is a nonsymmetric VDB topological index.
 Example 4. Let  be a set of digraphs of maximal degree p and . We define the general first Zagreb index  to be the VDB topological index induced by the  matrix with -entries . Clearly,  is a symmetric VDB topological index if and only if . Note that  is the usual first Zagreb  index.
 Definition 2 perfectly allows the possibility of considering nonsymmetric VDB topological indices defined over a set of graphs. However, if  has maximal degree p, then the representing function  satisfies , for all , since clearly, in this case, the number of arcs from vertices with out-degree i to vertices with in-degree j is the same as the number of arcs from vertices with out-degree j to vertices with in-degree i, for all . Based on this fact, we will show next that any VDB topological index defined over a set  can be reduced to a symmetric VDB topological index over 
Theorem 2. Let  be a VDB topological index defined over a set  of maximal degree p. Let  be the symmetric part of φ. Then  for all 
 Proof.  We know that 
 for all 
, since 
. Consequently,
        
        Hence,
        
□
 Example 5. Consider the general first Zagreb index  over the set  of all trees with  vertices. If , then by Theorem 2,where  and  are the first Zagreb index and Forgotten index, respectively. In particular, using ([23], Corollaries 1 and 2) we can solve the extreme value problem of  over the set of trees with  vertices:Equality in the left-hand side of (5) holds if and only if , while equality in the right-hand side ocurrs if and only if .    5. The General First Zagreb Index over Orientations of the Path
It follows from our previous section that the study of VDB topological indices over a set of graphs reduces to the study of symmetric VDB topological indices. It is our interest in this section, to analyze a VDB topological index over a set of digraphs (which are not graphs). Specifically, we study the general first Zagreb index over the set  as described in Example 2.
Let 
 be two different positive real numbers and consider the general first Zagreb index 
 over 
. Recall that 
 is a balanced orientation of 
 and 
 are sink-source orientations of 
 (see 
Figure 2). Note that 
 is the inverse orientation of 
, however, 
, which is a consequence of the fact that 
 is a nonsymmetric VDB topological index.
Theorem 3. Let  be two different positive real numbers and  an integer. Then:
- 1. 
-  is minimal in  with respect to . 
- 2. 
- If n is even, then  is maximal in  with respect to . 
- 3. 
- If n is odd and , then  is maximal in  with respect to . 
- 4. 
- If n is odd and , then  is maximal in  with respect to . 
 Proof.  Let 
 with matrix representation 
,
        
        and
        
- . By ( 1- ),
             - 
            Hence,  - . By Corollary 1,  -  is minimal in  -  with respect to  -  and
             
- Let  -  be even.  - . Using ( 1- ) we obtain,
             - 
            if  -  and  - . If  - , by (2)  - , and consequently  - . The only orientation of  -  satisfying these conditions is  - , but this orientation only exists when  n-  is odd. Similarly, if  - , by (2)  - , and consequently  - . The only orientation of  -  satisfying these conditions is  - , but this orientation only exists when  n-  is odd. 
- Hence,  - . By Corollary 1,  -  is maximal in  -  with respect to  -  and
             
- Let  -  be odd and  - .  - . Using ( 1- ) and (2) we obtain,
             - 
            Hence,  - . By Corollary 1,  -  is maximal in  -  with respect to  -  and
             
- Let  -  be odd and  - .  - . Using ( 1- ) and (2) we obtain,
             - 
            Hence,  - . By Corollary 1,  -  is maximal in  -  with respect to  -  and
             
        □
 Remark 1. By reversing the inequalities in the proof of Theorem 3, we deduce a dual version of Theorem 3 when  are two different negative real numbers, by simply substituting ’minimal’ by ’maximal’ and viceversa.
   6. Discussion
A VDB topological index over a set of digraphs 
 of maximal degree 
p is the composition
      
      where 
 is a representing function of 
 in the space of matrices 
 and 
 What makes it a 
vertex-degree-based topological index is the fact that the matrix representing the digraph 
 has entries containing information about the degrees of the vertices, namely, the degrees of the end-vertices of each arc in 
H. A natural question arises: what kind of topological indices do we obtain when we change the representing function of the set 
 of digraphs?
Let us discuss one specific example. Let G be a connected graph with vertex set V and edge set E. For , we denote by  the distance of u and v in G, that is, the length of the shortest path connecting u and v in G. Furthermore, we write  for the number of vertices in G closer to u than to v.
Consider the set 
 of all connected graphs with 
n vertices. Clearly, 
 has maximal degree 
. We represent each graph 
 by the matrix 
, where 
 is the number of edges 
 such that 
 and 
. On the other hand, consider the matrix 
, defined in each 
-entry as 
. Then we consider the composition 
 It turns out that for each 
,
      
     This is precisely the well-known Szeged index introduced by Gutman in [
21]. Similarly, if we choose the matrix 
 with 
-entry 
, then the composition 
 yields for each 
,
      
      In this case we obtain the well-known Mostar index introduced in [
22]. More generally, given any matrix 
 we can define the Szeged-like topological index 
 over 
.
  7. Conclusions
In conclusion, this new matrix approach to topological indices via a representing function of the set of digraphs into the space of matrices formalizes, unifies and gives a geometrical interpretation to the concept of a topological index. Also, it is important to emphasize that even in the case of graphs, it is possible to study nonsymmetric VDB topological indices (for instance, matrices induced by nonsymmetric bivariate functions as in the case of the general first Zagreb index), but in view of Theorem 2, these indices reduce to the study of symmetric VDB topological indices. Finally, it is important to point out that this matrix approach can be extended to different classes of topological indices, not necessarily vertex-degree-based indices.