Abstract
The basic goal of this research is to find the shortest path of a semidirected graph and apply it to the road network system. In the field of graph theory, networks are described as directed graphs, undirected graphs, or a combination of both. However, in the modern era of computing, several networks, such as social media networks, granular networks, and road transport networks, are not linked to any of the aforementioned network categories and in reality are a hybrid of networks with both directed and undirected interconnections. To better understand the notion of these types of networks, semidirected graphs have been developed to represent such networks. In a semidirect graph, both the directed and undirected edges concepts have been introduced together in a graph. In reality, it has been noted that for every node (source/destination) which is connected to another, some links/connections are directed—i.e., one-way—and some links/connections are undirected—i.e., two-way. Considering that there is no specific direction provided and that two nodes are connected, we have established the concept of an undirected edge as two-way connectivity since this provides for nodes in both ways. In this study, the road network system has been modelled using the concept of a semidirected graph, and the shortest path through it has been determined. For the purposes of illustration, we have used a real transportation road network in this case, and the computed results have been displayed.
Keywords:
Semidirected graph; weighted graph; shortest path; mixed graph; road networks; Floyd–Warshall algorithm MSC:
05C90; 90C35
1. Introduction
Since the development of the computer, optimal path selection for networks has been given more attention, and computation upgrading and optimization also have progressed over time. Researchers somewhere at time attempting continuously to put the most effective path selection algorithm in operation. For the graphical presentation of any network system, graph theory has taken on an important role. The fundamental idea of graph theory was first introduced by Swiss mathematician Leonhard Euler in the 18th century. Since then, the branch of graph theory has been rapidly evolving. Now, graph theory has several branches of research [1]. When representing a network graphically, the notation of both nodes and edges is important. Although it is presented by an undirected graph, investigating brain networks is one of the key research areas for scientists. The idea that brain networks may be a mixed directional combination of undirected and directed has been established by network researchers and scientists [2]. Another such example is networks of roads; some of them have a direction from source to destination and others have no direction at all. As a result, when a vehicle follows the directed path, it has a specific direction known as the one-way route. However, when a vehicle is moving in an arbitrary route from one point to another, it is logically travelling in both directions, making the arbitrary direction a bidirectional route. In order to represent the road network graphically, it may contain both directed and undirected edges, with the undirected edges logically being bidirectional edges (two-way routes). The mixed graph coloring problem was studied by Ries and Werra in 2008 [3]. It is necessary to keep in mind that mixed graphs usually include both directed and undirected edges. Hermitian adjacency matrices and Hermitian energies of mixed graphs have been studied by Liu and Li [4]. Using the idea of monographs, Abudayah et al. [5] explored mixed graphs and generalized the outcomes from earlier studies on the topic. Mixed adjacency matrixes of a mixed graphs have been studied by Adiga et al. [6]. Notable contributions made by different researchers to the analyses of different graph-related problems are presented in Table 1.
Table 1.
Notable contributions implemented by different researchers to the analyses of different graph-related problems.
In this study, we took into account semidirected graphs, whose edges can be visualized as both directed and undirected graphs. All undirected edges are first converted into two bidirectional edges for the purpose of determining the shortest path in a semidirect graph, and all pair search techniques are then applied using the Floyd–Warshall algorithm. As we know, the Floyd–Warshall algorithm uses dynamic programming approaches to obtain the optimal solution with a coherent decision. Therefore, for multiple possible solutions, this algorithm is mostly used. Some research, shown in Table 2, discusses the use of the Floyd–Warshall algorithm for determining the best path.
Table 2.
Use of the Floyd–Warshall algorithm for determining the best path.
We have modified the Floyd–Warshall algorithm that is currently in use to establish the optimal path (result) of a semidirected graph. The modified Floyd–Warshall algorithm usually equates the distances (intersections) between points from the initial point to the destination point and compares each route alternative to its measuring distance. Every edge in a semidirect graph/network must have a direction in order to apply the proposed methodology. Therefore, we converted the undirected edges into two directed edges before implementing the procedure. In this paper, the road network system has been modelled using the concept of a semidirected graph, and the shortest path through it has been determined. In this case, a practical transportation road network has been adopted for example purposes, and the computed results have been presented.
2. Contributions and Objectives
The contributions and objectives of the proposed research are listed below.
- We have studied the semidirected graph and implemented it on road/transport networks.
- We have investigated the optimal shortest path of the semidirected graph.
- We have modified the Floyd–Warshall algorithm to find a semidirected graph’s shortest path.
- We have converted the undirected graph into a bidirectional one using the Floyd–Warshall algorithm.
- We have implemented the Floyd–Warshall algorithm for the bidirectional graph.
- A real case study has been considered and solved for illustration purposes.
- Conclusions and future direction of the proposed research have been made.
2.1. The Majority of the Work Conducted for This Research Can Be Summarized as Follows
(i) We have studied the semidirected graph and implemented it on road/transport networks. (ii) We have modified the Floyd–Warshall algorithm for finding the shortest path of a semidirected graph. (iii) We used the Floyd–Warshall algorithm for a bidirectional graph to find the optimal shortest path. (vi) A real case study has been considered and solved for experiment purposes.
The rest of the work is presented as follows. Section 2 presents Definition and Preliminaries to develop the entire paper. In order to accomplish the study, Section 3 provides conversion of undirected edges to directional edges. Different types of shortest path are discussed in Section 4. An algorithm for finding shortest path of a semidirected graph is presented in Section 5. Numerical example and illustration with case study have been presented in Section 6. The concluding remarks of the research are included in Section 7. We provide a list of notations and their meanings in a tabular format as below (see Table 3), which are used in the paper to help the reader.
Table 3.
Notation and meanings.
2.2. Definition and Preliminaries
In order to develop the entire paper, we have included some definitions and explanations in this section.
Definition 1.
(Semidirected graph) A graph is called a semidirect graph, where is a set of nonempty sets of vertices, is a set of directed edges, and is a set of undirected edges.
Example 1.
Figure 1.
Semidirected graph.
Definition 2.
(Undirected walk) In a semidirected graphan undirected walk is a sequence of , whereare vertices of the semidirected graph andare undirected edges.
Definition 3.
(Directed walk) In a semidirect graph, an undirected walk is a sequence of , where are vertices of the semidirect graph and are directed edges.
Definition 4.
(Adjacency matrix of a semidirected graph) An adjacent matrix is a tool that is used to represent the connection of vertices that are adjacent to each other in a finite graph. Therefore, in a finite graph, if there is a connection between a pair of vertices, then it is represented by binary value 1, and if there is no connection between a pair of vertices, then it is represented by binary value 0. The finite graph can be represented by a square matrix wheresuch that
Definition 5.
(Edge) An edge (or link) of a network (or graph) is one of the connections between the nodes (or vertices) of the network. Incident edges are edges that share a node. Let,’’ be called the edge if and only if it is a link between a pair of nodes or vertices.
Example 2.
Definition 6.
(Shortest path) According to graph theory, the shortest path is one that connects two vertices of a graph such that the total weights of the individual edges are kept to a minimum.
3. Conversion of Undirected Edges to Directional Edges
We have now reviewed how to convert a graph’s undirected edges into directed edges.
Definition 7.
(Undirected edges to directed edge) An edgeis called the directional edge if and only ifinstead of, where, the edge or link between the verticesand. Therefore, if two vertices or nodes are connected by a link or edge and if the edge has no direction, then one can convert the undirected link or edge into a directed edge.Figure 2 represents a semidirected graph with bidirectional edges.
Figure 2.
Semidirect graph (bidirectional edges).
Example 3.
Let,and ifbe the undirected edge between vertices, then the edge is called a bidirectional edge if and only ifinstead of. In a similar manner,can be represented as a bidirectional edge (see Figure 2).
Definition 8.
(Weighted semidirected graph) A semidirect graph with vertex set, directed edge set, and undirected edge setis called a weighted graph if every edge(directed or undirected) of graphcontains a numerical value. is the weight of the graph.
Example 4.
From Figure 3
, the weights of the graph are , where are sets of bidirectional weights and are sets of directed edges.
Figure 3.
Weighted semidirected graph.
4. Different Types of Shortest Path
Numerous shortest path issues have been addressed in the literature with regard to theory. Some of these are as follows:
- (i)
- Single-pair shortest path (SPSP) problem.
- (ii)
- Single-source shortest path (SSSP) problem
- (iii)
- Single-destination shortest path (SDSP) problem
- (iv)
- All pairs’ shortest path (APSP) problem
For the single-pair shortest path (SPSP) problem, we have mentioned the following points.
- The single-pair shortest path (SPSP) finds the shortest path either between a single pair of nodes or the shortest path between a particular pair of nodes.
- Find the shortest path from to .
- The well-known A * search algorithm has been used to solve the shortest path problem of a single pair.
We have identified the following for the single source shortest path (SSSP) problem:
- This is the shortest-path problem, in which the shortest path from a particular source node to all other remaining nodes has been computed.
- Find the shortest path from source to all vertices .
- Dijkstra’s algorithm and the Bellman–Ford algorithm are well-known algorithms used to solve the problem for finding the shortest path.
The single-destination shortest path (SDSP) problem can be viewed as follows:
- The shortest path problem that computes the shortest path from all vertices to one of the target vertices.
- This problem reduces to a single-source shortest path problem by reversing the direction of each edge in the graph.
- A well-known Dijkstra’s algorithm has been applied to solve the problem of finding the shortest path to the destination.
The all-pair shortest path (APSP) problem can be summarized as follows:
- The shortest path problem that computes the shortest path between each pair of vertices.
- The Floyd–Warshall algorithm and the Johnson algorithm are known algorithms used to solve the problem of finding the shortest path for all pairs.
- Find the shortest path from to for all .
From Table 4, we analyzed the different types of algorithms, and we found that the different types of shortest path algorithms are applicable to either undirected edges or directed edges. However, our proposed algorithm can apply to both the undirected and directed edges or semidirected edges. In real life, it is found that all networks are not only associated with the only undirected edge or directed edge, but sometimes, the network is also associated with both undirected and directed edges. Our proposed algorithm is very fruitful in evaluating the shortest path in that situation. It can also calculate the shortest path of all pairs of vertices and the time complexity .
Table 4.
Describing different SPAs (shortest path algorithms).
5. Algorithm for Finding Shortest Path of a Semidirected Graph
Here, we have proposed an algorithm for finding the shortest path of a semidirected graph. In our proposed algorithm, there are two phases. In Phase 1, we have converted unidirectional edge to bidirectional edge, and we applied the Floyd–Warshall algorithm in Phase 2.
Phase 1:
# Algorithm for conversion of unidirectional edge to bidirectional edge
Step 1: Initially choose a Semidirected graph .
Step 2: Create a set of all unvisited set .
Step 3: select all
Step 4: update all in
(i) then instead of
(ii)
Phase 2:
# Implementation of Floyd-Warshall algorithm for Bidirectional graph
Step 1: Initially take a graph
Step 2: Set as a square matrix where is the number of stages and no of nodes.
Step 3: Compute when and
where
Step 4: Repeat the following step for
For calculate the and
where
Step 5: Return and exit
5.1. Pseudocode for Conversion of Unidirectional Edge to Directional Edge
Algorithm bidirectional edge
Initialized
;
;
;
;
if then print (“draw a directed edge from ”);
else
for
print (“draw a bi -directed edge between ”);
5.2. Pseudo-Code for Shortest Path of a Semidirected Graph
Algorithm of shortest path
;
;
for
for
for
do
return
The Floyd–Warshall algorithm takes time , where is the number of vertices in graph .
6. Numerical Example and Illustration
For the implementation of shortest path algorithm on a semidirected graph we have considered a network (see Figure 4). From Figure 4, we can write and . Now, we have applied our proposed algorithm. After execution of Phase 1, we have an equivalent bidirectional graph, which is depicted in Figure 5.
Figure 4.
Semidirect graph of a road network system.
Figure 5.
Equivalent bidirectional graph of semidirected graph.
After Phase 1, proceeded through Phase 2 of our proposed algorithm. Finally, we obtained the sequence of matrices as follows:
defines the initial distance matrix of the bidirectional graph of a semidirected network, and this matrix represents the direct connection of the edge between two nodes. Undirected connections are represented by .
defines the distance matrix via node 1, compares each node’s distance with the distance of the direct node and via node 1, and replaces it with the minimum distance.
defines the distance matrix via node 2, compares the distance of each node with the distance of the direct node and via node 2, and replaces it with the minimum distance.
defines the distance matrix via node 3, compares the distance of each node with the distance of the direct node and via node 3, and replaces it with the minimum distance.
defines the distance matrix via node 4, compares each node’s distance with the distance of the direct node and via node 4, and replaces it with the minimum distance. gives the final shortest path between every pair of vertices.
A Real Case Study (Survey Results)
In this research, we have considered a case study which has been implemented on a road network (see Figure 6). This road is situated at Durgapur Express Way of the Paschim Burdwan district, West Bengal, India. This is a transport/road network system, and finding of shortest path of this network is based on finding a shortest path of a semidirected graph. For successfully execution of our proposed algorithm, we collected data from five places (the five places are listed in Table 5). These five places have been denoted as a node of a semidirected graph. The network diagram of this semidirected graph are shown in Figure 6. Descriptions of path type and distance are given in Table 6. Descriptions of path name with distance using Google Maps are shown in Figure 7.
Figure 6.
Semidirected network of a road network system.
Table 5.
Description of node.
Table 6.
Description of path type and distance.
Figure 7.
Description of path name with distance using Google Maps.
Using Phase 1 of our proposed algorithm, we have obtained an equivalent bidirectional graph, which is shown in Figure 8.
Figure 8.
Equivalent bidirectional graph of a semidirected graph (Figure 6).
After Phase 1, we proceeded through Phase 2 of our proposed algorithm and obtained the sequence of matrices which is as follows:
where is the initial matrix of the network.
gives the shortest distance of all pairs’ vertices via node 1, i.e., via Durgapur City center.
gives the shortest distance of all pairs’ vertices via node 2, i.e., via Andal More.
gives the shortest distance of all pairs’ vertices via node 3, i.e., via Andal Station road.
gives the shortest distance of all pairs’ vertices via node 4, i.e., via Ukhra Station.
And gives the final shortest distance of all pairs’ vertices via node 5, i.e., via Raniganj Panjabi More.
7. Conclusions
In this proposed paper, we have obtained the shortest path of a semidirected graph, and a real case study has been considered and solved. The proposed method for finding the shortest path of a semidirected graph is very useful for finding the shortest path of a transport network in any highway in the minimum time because all existing shortest path algorithms can evaluate the shortest path from either the directed or the undirected network. However, in our real-life road network system, networks are sometimes associated with unidirectional or directional edges. In these cases, it is very difficult to evaluate the shortest path. Hence, the proposed modified Floyd–Warshall algorithm can solve that problem.
The proposed algorithm is executed in two phases. First phase of the algorithm is able to convert all undirected edges into directed edges. Then, all undirected edges of the semidirected graph are converted into directed edges, and the semidirected graph is converted into a directed graph; then, the second phase of the proposed algorithm is able to identify the shortest path via Floyd–Warshall algorithm. Therefore, this proposed approach is a fruitful implementation for a modern road network system in which both directed and undirected roads have been found, and the proposal of this paper helps to determine the shortest path of a semidirected graph. It will be very helpful for automated driving systems (ADS) in the future. In future work, one could evaluate the congestion of the undirected edges or the bidirectional edges since traversal in both directions may lead to congestion.
Author Contributions
R.D., L.S., S.S., V.S. and T.S. formulated and studied the problem. R.D., L.S., S.S., V.S. and T.S. wrote the first draft of the manuscript. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Not applicable.
Conflicts of Interest
The authors declare no conflict of interest.
References
- Samanta, S.; Pal, M.; Mahapatra, R.; Das, K.; Bhadoria, R.S. A Study on Semi-directed Graphs for Social Media Networks. Int. J. Comput. Intell. Syst. 2021, 14, 1034–1041. [Google Scholar] [CrossRef]
- Sporns, O. Graph theory methods: Applications in brain networks. Dialogues Clin. Neurosci. 2018, 20, 111–121. [Google Scholar] [CrossRef] [PubMed]
- Ries, B.; De Werra, D. On two coloring problem of a mixed graph. Eur. J. Comb. 2008, 29, 712–725. [Google Scholar] [CrossRef][Green Version]
- Liu, J.; Li, X. Hermitian-adjacency matrices and Hermitian energies of mixed graphs. Linear Algebra Its Appl. 2015, 466, 182–207. [Google Scholar] [CrossRef]
- Abudayah, M.; Alomari, O.; Sander, T. Incidence matrices and line graphs of mixed graphs. arXiv 2022, arXiv:2205.05375. [Google Scholar]
- Adiga, C.; Rakshith, B.R.; So, W. On the mixed adjacency matrix of a mixed graph. Linear Algebra Its Appl. 2016, 495, 223–241. [Google Scholar] [CrossRef]
- Orlin, J.B.; Madduri, K.; Subramani, K.; Williamson, M. A faster algorithm for single source shortest path problem with few distinct positive length. J. Discret. Algorithm 1999, 8, 189–198. [Google Scholar] [CrossRef]
- Thorup, M. Undirected single source shortest path in linear time. J. ACM 1999, 46, 362–394. [Google Scholar] [CrossRef]
- Katerinis, P.; Tsikopoulosk, N. Edge-connectivity and the orientation of a graph. SUT J. Math. 2004, 41, 1–10. [Google Scholar] [CrossRef]
- Bonato, A.; Delic, D.; Wang, C. The Structure and Automorphisms of Semi-directed Graphs. J. Multi-Valued Log. Soft Comput. 2010, 27, 161–173. [Google Scholar]
- Wang, Z.H.; Shi, S.S.; Yu, L.C.; Chen, W.Z. An efficient constrained shortest path algorithm for traffic navigation. Adv. Mater. Res. 2012, 356, 2880–2885. [Google Scholar]
- Jicy, N.; Mathew, S. Some new connectivity parameters for weighted graphs. J. Uncertain. Math. Sci. 2014, 2014, 1–9. [Google Scholar] [CrossRef][Green Version]
- Mohammed, A.M. Mixed graph representation and mixed graph isomorphism. Gazi Univ. J. Sci. 2017, 30, 303–310. [Google Scholar]
- Sotskov, Y.N. Mixed Graph Colorings: A Historical Review. Mathematics 2020, 8, 385. [Google Scholar] [CrossRef]
- Zeen El Deen, M.R.; Omar, N.A. Extending of Edge Even Graceful Labeling of Graphs to Strong r-Edge Even Graceful Labeling. J. Math. 2021, 2021, 1–19. [Google Scholar] [CrossRef]
- Li, S.; Li, Y. Semi-dynamic shortest-path tree algorithms for directed graphs with arbitrary weights. arXiv 2021, arXiv:1903.01756. [Google Scholar]
- Singh, A.; Mishra, P.K. Performance Analysis of Floyd-Warshall Algorithm vs. Rectangular Algorithm. Int. J. Comput. Appl. 2014, 107, 23–27. [Google Scholar] [CrossRef]
- Ramadiani; Bukhori, D.; Azainil; Dengen, N. Floyd-Warshall algorithm to determine the shortest path based on android. IOP Conf. Ser. Earth Environ. Sci. 2018, 144, 1–9. [Google Scholar] [CrossRef]
- Triana, Y.S.; Syahputri, I. Implementation Floyd-Warshall Algorithm for the Shortest Path of Garage. Int. J. Innov. Sci. Res. Technol. 2018, 3, 871–878. [Google Scholar]
- Brodnik, A.; Grgurovic, M.; Pozar, R. Modifications of the Floyd-Warshall algorithm with nearly quadratic expected-time. ARS Math. Contemp. 2021, 22, 1–22. [Google Scholar] [CrossRef]
- Sahoo, L.; Sen, S.; Tiwary, K.S.; Samanta, S.; Senapati, T. Modified Floyd–Wars hall’s Algorithm for Maximum Connectivity in Wireless Sensor Networks under Uncertainty. Discret. Dyn. Nat. Soc. 2022, 2022, 1–11. [Google Scholar]
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 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/).