# Widest Path in Networks with Gains/Losses

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

- $\underset{P\in \mathbb{P}}{\mathrm{min}}{\displaystyle \sum}_{\left(i,j\right)\in P}{l}_{ij}$ for SP problems.
- $\underset{P\in \mathbb{P}}{\mathrm{max}}{\displaystyle \prod}_{\left(i,j\right)\in P}{p}_{ij}$ for MRP problems.
- $\underset{P\in \mathbb{P}}{\mathrm{max}}\text{}{\underset{\left(i,j\right)\in P}{\mathrm{min}}}_{\text{}}{u}_{ij}\text{}$for WPP.

## 2. Preliminaries

## 3. Problem Formulation

- -
- ${x}_{ij}$, representing the flow entering arc $\left(i,j\right)$.
- -
- ${y}_{ij}$, a binary variable that determines whether or not arc $\left(i,j\right)$ carries a positive flow ($1$ if it does, $0$ otherwise).

- The variables ${v}_{s}$ and ${v}_{t}$ represent the flow leaving the source node $s$ and the flow entering the sink node $t$, respectively.
- Constraints (1b) and (1d) correspond to the balanced flow constraint and the bound constraints commonly found in maximum flow problems [4].
- Constraint (1c) ensures that, at most, one outgoing arc from any node is capable of sending flow. This constraint guarantees that flow is sent only along a single $st$-path.
- The formulation (1) of the GWPP closely resembles that of generalized maximum flow problems, with the added inclusion of zero-one variables ${y}_{ij}$ and the constraint (1c) [4].

**Remark 1.**

## 4. Algorithms for the Case of Losses on Arcs

**Theorem 1.**

Algorithm 1 (Alg1) |

Input: An instance of the generalized WPP Output: An optimal path for $\left(i,j\right)\in A$: if $i==s:$Set ${\overline{l}}_{ij}=-\mathrm{log}{p}_{ij}{u}_{ij}$ and ${P}_{ij}=\left(i,j\right)$ else: Set ${\overline{l}}_{ij}=-\mathrm{log}{p}_{ij}$ and ${P}_{ij}=\varnothing $ while True: Find a shortest path $P$ with respect to ${\overline{l}}_{ij}$ if ${P}_{s{j}_{P}}\ne \varnothing :$ The optimal path is ${P}_{s{j}_{P}}\cup P\backslash \left\{\left(s,{j}_{P}\right)\right\}$ else:Find the last arc $\left({i}_{P},{j}_{P}\right)$ of $P$ to be saturated. Remove $\left({i}_{P},{j}_{P}\right)$. Add an artificial arc $\left(s,{j}_{P}\right)$ $\mathrm{Set}\text{}{\overline{l}}_{s{j}_{P}}=-\mathrm{log}({u}_{{i}_{P}{j}_{P}}{p}_{{i}_{P}{j}_{P}})$ |

- -
- Constraint (1c): For each node $j\ne s$, there exists, at most, one outgoing arc with positive flow. This condition ensures that the flow is sent only along a single $st$-path.
- -
- Capacity Constraint: For each arc $\left(i,j\right)$, the flow through the arc must not exceed its capacity. Mathematically, this can be written as ${f}_{ij}\le {u}_{ij}$, where ${f}_{ij}$ represents the flow on arc $\left(i,j\right)$ and ${u}_{ij}$ represents the capacity of arc ($i,j)$.
- -
- Flow Conservation: The flow conservation principle must be satisfied at every node (except the source and sink nodes). For any node $j\ne s$ and $j\ne t$, the sum of incoming flows must equal the sum of outgoing flows. Mathematically, this can be expressed as ${{\displaystyle \sum}}_{\left(i,j\right)\in A}{f}_{ij}-{{\displaystyle \sum}}_{\left(j,k\right)\in A}{f}_{jk}=0$.
- -
- Optimality Condition: For each node $j\ne s$, the label $d\left(j\right)$ represents the maximum flow sent from the source node $s$ to node $j$. Therefore, we have $d\left(j\right)={{\displaystyle \sum}}_{\left(i,j\right)\in A}{f}_{ij}-{{\displaystyle \sum}}_{\left(j,k\right)\in A}{f}_{jk},$ where ${f}_{ij}$ represents the flow on arc $\left(i,j\right)$ and ${f}_{jk}$ represents the flow on arc $\left(j,k\right)$.

**Theorem 2.**

**Proof of Theorem 2.**

Algorithm 2 (Alg. 2) |

Input: An instance of the generalized WPP Output: An optimal path for $i\in V:$ Set $d\left(i\right)=0$ Set${d}_{s}=+\infty $ Set ${S}_{0}=\left\{\right\};$ $\overline{S}=V$ while $\left|S\right|<n$: Let $i\in S$ be a node for which ${d}_{i}=\mathrm{max}\left\{{d}_{j}:j\in \overline{S}\right\}$; $\overline{S}=\overline{S}\backslash \left\{i\right\};$ for each $j\in V:\left(i,j\right)\in A$: if ${d}_{j}<{p}_{ij}\mathrm{min}\left\{{u}_{ij},{d}_{i}\right\}$: Update ${d}_{j}={p}_{ij}\mathrm{min}\left\{{u}_{ij},{d}_{i}\right\}$ Update$\text{}S=SU\left\{i\right\}$; |

- Algorithm 2 iterations:

## 5. Gain/Loss Case of the GWPP

Algorithm 3 (Alg. 3) |

Input: An instance of the GWPP with gain/loss factors Output: An optimal path for $i\in V:$Set${d}_{\mathrm{i}}=0,pre{d}_{i}=-1,{S}_{i}=false$ Set ${d}_{\mathrm{s}}=+\infty $, $Q=\left\{s\right\};$ while Q has elements: $i=poolQ;$ ${S}_{i}=false;$ for $\left(i,j\right)\in A$: if ${d}_{j}<{p}_{ij}\mathrm{min}\left\{{u}_{ij},{d}_{i}\right\}$: Update ${d}_{j}={p}_{ij}\mathrm{min}\left\{{u}_{ij},{d}_{i}\right\}.$ Set $pre{d}_{j}=i.$ if ${S}_{j}==false$: $Q=QU\left\{j\right\}$; ${S}_{j}=true;$ Restore the optimal path by the $Pred$ indices. |

- Algorithm 3 iterations:

No. itr. | Selected Edge | Structure | Structure Data |

0—init. | - | Q | [1] |

S | [true,false,false,false,false,false,false,false] | ||

d | [inf, 0, 0, 0, 0, 0, 0, 0] | ||

Pred. | [−1, −1, −1, −1, −1, −1, −1, −1] | ||

1 | (1,2) | Q | [2] |

S | [false,true,false,false,false,false,false,false] | ||

d | [inf, 6.02, 0, 0, 0, 0, 0, 0] | ||

Pred. | [−1, 1, −1, −1, −1, −1, −1, −1] | ||

2 | (1,3) | Q | [2, 3] |

S | [false,true,true,false,false,false,false,false] | ||

d | [inf, 6.02, 5.84, 0, 0, 0, 0, 0] | ||

Pred. | [−1, 1, 1, −1, −1, −1, −1, −1] | ||

3 | (1,4) | Q | [2, 3, 4] |

S | [false,true,true,true,false,false,false,false] | ||

d | [inf, 6.02, 5.84, 8.20, 0, 0, 0, 0] | ||

Pred. | [−1, 1, 1, 1, −1, −1, −1, −1] | ||

3 | (2,3) | Q | [3, 4] |

S | [false,false,true,true,false,false,false,false] | ||

d, Pred. | No change | ||

4 | (2,5) | Q | [3, 4, 5] |

S | [false,false,true,true,true,false,false,false] | ||

d | [inf, 6.02, 5.84, 8.20, 4.45, 0, 0, 0] | ||

Pred. | [−1, 1, 1, 1, 2, −1, −1, −1] | ||

5 | (3,2) | Q | [4, 5] |

S | [false,false,false,true,true,false,false,false] | ||

d, Pred. | No change | ||

5 | (3,4) | Q, S, d, Pred. | No change |

6 | (3,5) | Q, S, d, Pred. | No change |

7 | (4,3) | Q | [5] |

S | [false,false,false,false,true,false,false,false] | ||

d, Pred. | No change | ||

8 | (4,5) | Q, S | No change |

d | [inf, 6.02, 5.84, 8.20, 5.44, 0, 0, 0] | ||

Pred. | [−1, 1, 1, 1, 4, −1, −1, −1] | ||

9 | (5,6) | Q | [6] |

S | [false,false,false,false,false,true,false,false] | ||

d | [inf, 6.02, 5.84, 8.20, 5.44, 0.90, 0, 0] | ||

Pred. | [−1, 1, 1, 1, 4, 5, −1, −1] | ||

10 | (5,7) | Q | [6, 7] |

S | [false,false,false,false,false,true,true,false] | ||

d | [inf, 6.02, 5.84, 8.20, 5.44, 0.90, 1.0, 0] | ||

Pred. | [−1, 1, 1, 1, 4, 5, 5, −1] | ||

11 | (5,6) | Q | [6, 7, 8] |

S | [false,false,false,false,false,true,true,true] | ||

d | [inf, 6.02, 5.84, 8.20, 5.44, 0.90, 1.0, 2.0] | ||

Pred. | [−1, 1, 1, 1, 4, 5, 5, 5] | ||

12 | (6,8) | Q | [7, 8] |

S | [false,false,false,false,false,false,true,true] | ||

d, Pred. | No change | ||

13 | (7,8) | Q | [8] |

S | [false,false,false,false,false,false,false,true] | ||

d, Pred. | No change | ||

14 | (8,-) No neighbors | Q | [EMPTY] |

S | [false,false,false,false,false,false,false,false] | ||

d, Pred. | No change |

**Theorem 3.**

**Proof of Theorem 3.**

## 6. Experiments and Discussions

## 7. Conclusions

## Author Contributions

## Funding

## Data Availability Statement

## Conflicts of Interest

## References

- Dijkstra, E.W. A note on two problems in connexion with graphs. Numer. Math.
**1959**, 1, 269–271. [Google Scholar] [CrossRef] - Bellman, R. On a routing problem. Q. Appl. Math.
**1958**, 16, 87–90. [Google Scholar] [CrossRef] - Ford, L.R., Jr.; Fulkerson, D.R. A Shortest Chain Algorithm: Flows in Networks; Princeton University Press: Princeton, NJ, USA, 1962; pp. 130–134. [Google Scholar]
- Ahuja, R.K.; Magnanti, T.L.; Orlin, J.B. Network Flows; Prentice Hall: Hoboken, NJ, USA, 1993. [Google Scholar]
- Punnen, A.P. A linear time algorithm for the maximum capacity path problem. Eur. J. Oper. Res.
**1991**, 53, 402–404. [Google Scholar] [CrossRef] - Berman, O.; Handler, G.Y. Optimal Minimax Path of a Single Service Unit on a Network to Nonservice Destinations. Transp. Sci.
**1987**, 21, 115–122. [Google Scholar] [CrossRef] - Kaibel, V.; Peinhardt, M.A.F. On the Bottleneck Shortest Path Problem; ZIB-Report 06-22; Konrad-Zuse-Zentrum für Informationstechnik Berlin: Berlin, Germany, 2006. [Google Scholar]
- Gabow, H.N.; Tarjan, R.E. Algorithms for two bottleneck optimization problems. J. Algorithms
**1988**, 9, 411–417. [Google Scholar] [CrossRef] - Schulze, M. A new monotonic, clone-independent, reversal symmetric, and Condorcet-consistent single-winner election method. Soc. Choice Welf.
**2011**, 36, 267–303. [Google Scholar] [CrossRef] - Fernandez, E.; Garfinkel, R.; Arbiol, R. Mosaicking of aerial photographic maps via seams defined by bottleneck shortest paths. Oper. Res.
**1998**, 46, 293–304. [Google Scholar] [CrossRef] - Ullah, E.; Lee, K.; Hassoun, S. An algorithm for identifying dominant-edge metabolic pathways. In Proceedings of the 2009 IEEE/ACM International Conference on Computer-Aided Design-Digest of Technical Papers, San Jose, CA, USA, 2–5 November 2009; pp. 144–150. [Google Scholar]
- Deaconu, A.M.; Ciupala, L.; Spridon, D. Finding minimum loss path in big networks. In Proceedings of the 22nd International Symposium on Parallel and Distributed Computing (ISPDC), Bucharest, Romania, 10–12 July 2023; pp. 39–44. [Google Scholar]
- Ford, L.R.; Fulkerson, D.R. Maximal flow through a network. Can. J. Math.
**1956**, 8, 399–404. [Google Scholar] [CrossRef] - Edmonds, J.; Karp, R.M. Theoretical improvements in algorithmic efficiency for network flow problems. JACM
**1972**, 19, 248–264. [Google Scholar] [CrossRef] - Tayyebi, J.; Rîtan, M.-L.; Deaconu, A.M. Generalized Maximum Capacity Path Problem with Loss Factors. In Proceedings of the 13th International Conference on Operations Research and Enterprise Systems (ICORES 2024), Rome, Italy, 24–26 February 2024; pp. 302–308, ISBN 978-989-758-681-1. ISSN 2184-4372. [Google Scholar]
- Tayyebi, J.; Deaconu, A. Inverse generalized maximum flow problems. Mathematics
**2019**, 7, 899. [Google Scholar] [CrossRef] - Moore, E.F. The shortest path through a maze. In Proceedings of the International Symposium on the Theory of Switching; Harvard University Press: Cambridge, MA, USA, 1959. [Google Scholar]
- Ortega-Arranz, H.; Torres, Y.; Llanos, D.R.; Gonzalez-Escribano, A. A new GPU-based approach to the Shortest Path problem. In Proceedings of the 2013 International Conference on High Performance Computing & Simulation (HPCS), Helsinki, Finland, 1–5 July 2013; pp. 505–511. [Google Scholar]
- Deaconu, A.M.; Spridon, D. Adaptation of Random Binomial Graphs for Testing Network Flow Problems Algorithms. Mathematics
**2021**, 9, 1716. [Google Scholar] [CrossRef] - Erdős, P.; Rényi, A. On Random Graphs. I. Publ. Math.
**1959**, 6, 290–297. [Google Scholar] [CrossRef]

No. itr. | Structure | Structure Data |
---|---|---|

1 | D | [inf, 0, 0, 0, 0, 0, 0, 0] |

S | [1] | |

Pred. | [−1, −1, −1, −1, −1, −1, −1, −1] | |

2 | D | [inf, 6.02, 5.84, 8.2, 0, 0, 0, 0] |

S | [2, 3, 4] | |

Pred. | [−1, 1, 1, 1, −1, −1, −1, −1] | |

3 | D | [inf, 6.02, 5.84, 8.2, 5.44, 0, 0, 0] |

S | [2, 3, 5] | |

Pred. | [−1, 1, 1, 1, 4, −1, −1, −1] | |

4 | D | [inf, 6.02, 5.84, 8.2, 5.44, 0, 0, 0] |

S | [3, 5] | |

Pred. | [−1, 1, 1, 1, 4, −1, −1, −1] | |

5 | D | [inf, 6.02, 5.84, 8.2, 5.44, 0, 0, 0] |

S | [5] | |

Pred. | [−1, 1, 1, 1, 4, −1, −1, −1] | |

6 | d | [inf, 6.02, 5.84, 8.2, 5.44, 0.9, 1, 2] |

S | [6, 7, 8] | |

Pred. | [−1, 1, 1, 1, 4, 5, 5, 5] | |

7 | D | [inf, 6.02, 5.84, 8.2, 5.44, 0.9, 1, 2] |

S | [6, 7] | |

Pred. | [−1, 1, 1, 1, 4, 5, 5, 5] | |

8 | D | [inf, 6.02, 5.84, 8.2, 5.44, 0.9, 1, 2] |

S | [6] | |

Pred. | [−1, 1, 1, 1, 4, 5, 5, 5] | |

9 | D | [inf, 6.02, 5.84, 8.2, 5.44, 0.9, 1, 2] |

S | [EMPTY] | |

Pred. | [−1, 1, 1, 1, 4, 5, 5, 5] |

No. of Nodes | No. of Instances | No. of Paths | No. of Cycles | Erdős–Rényi Prob. | No. |
---|---|---|---|---|---|

1000 | 10,000 | 500 | 100 | 0.5 | 1 |

500 | 100 | 0.7 | 2 | ||

500 | 100 | 0.9 | 3 | ||

2000 | 1000 | 1000 | 100 | 0.1 | 4 |

1000 | 250 | 0.15 | 5 | ||

1000 | 500 | 0.6 | 6 | ||

5000 | 100 | 2500 | 1000 | 0.1 | 7 |

2500 | 1000 | 0.2 | 8 | ||

2500 | 1000 | 0.3 | 9 | ||

10,000 | 5 | 5000 | 2500 | 0.15 | 10 |

5000 | 2500 | 0.3 | 11 | ||

5000 | 2500 | 0.5 | 12 | ||

15,000 | 3 | 7500 | 1000 | 0.15 | 13 |

20,000 | 2 | 7500 | 1000 | 0.15 | 14 |

25,000 | 1 | 8000 | 1500 | 0.15 | 15 |

No. | Algorithm 1 CPU | Algorithm 1 GPU | Algorithm 2 | Algorithm 3 | Algorithm 1 GPU vs. Algorithm 2 (Times Faster) | Algorithm 2 vs. Algorithm 3 (Times Faster) |
---|---|---|---|---|---|---|

1 | 165.75 | 187.30 | 3.98 | 5.55 | 0.02 | 1.39 |

2 | 121.1 | 138.66 | 5.02 | 7.52 | 0.04 | 1.49 |

3 | 188.96 | 311.78 | 6.06 | 9.52 | 0.02 | 1.57 |

4 | 30.22 | 52.40 | 6.86 | 8.90 | 0.13 | 1.29 |

5 | 120.00 | 209.34 | 23.00 | 36.18 | 0.10 | 1.57 |

6 | 193.50 | 315.60 | 16.92 | 27.88 | 0.05 | 1.64 |

7 | 183.00 | 71.52 | 40.15 | 52.19 | 0.56 | 1.29 |

8 | 284.30 | 103.41 | 41.7 | 55.00 | 0.40 | 1.31 |

9 | 626.6 | 226.74 | 61.4 | 76.45 | 0.27 | 1.24 |

10 | 671.10 | 89.21 | 98.01 | 117.61 | 1.10 | 1.19 |

11 | 677.14 | 67.78 | 216.00 | 302.40 | 3.19 | 1.40 |

12 | 940.20 | 76.15 | 358.01 | 466.6 | 4.70 | 1.30 |

13 | 1306.07 | 49.41 | 265.33 | 424.52 | 4.82 | 1.59 |

14 | 2965.04 | 53.48 | 452.11 | 524.44 | 8.46 | 1.15 |

15 | 3549.10 | 32.11 | 826.04 | 966.46 | 25.72 | 1.16 |

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. |

© 2024 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/).

## Share and Cite

**MDPI and ACS Style**

Tayyebi, J.; Rîtan, M.-L.; Deaconu, A.M.
Widest Path in Networks with Gains/Losses. *Axioms* **2024**, *13*, 127.
https://doi.org/10.3390/axioms13020127

**AMA Style**

Tayyebi J, Rîtan M-L, Deaconu AM.
Widest Path in Networks with Gains/Losses. *Axioms*. 2024; 13(2):127.
https://doi.org/10.3390/axioms13020127

**Chicago/Turabian Style**

Tayyebi, Javad, Mihai-Lucian Rîtan, and Adrian Marius Deaconu.
2024. "Widest Path in Networks with Gains/Losses" *Axioms* 13, no. 2: 127.
https://doi.org/10.3390/axioms13020127