<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "JATS-journalpublishing1-3.dtd">
<article article-type="research-article" dtd-version="1.3" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="ru"><front><journal-meta><journal-id journal-id-type="publisher-id">sapi</journal-id><journal-title-group><journal-title xml:lang="ru">Системный анализ и прикладная информатика</journal-title><trans-title-group xml:lang="en"><trans-title>«System analysis and applied information science»</trans-title></trans-title-group></journal-title-group><issn pub-type="ppub">2309-4923</issn><issn pub-type="epub">2414-0481</issn><publisher><publisher-name>Belarusian National Technical University</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.21122/2309-4923-2024-4-4-12</article-id><article-id custom-type="elpub" pub-id-type="custom">sapi-700</article-id><article-categories><subj-group subj-group-type="heading"><subject>Research Article</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="ru"><subject>Системный анализ</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="en"><subject>System analysis</subject></subj-group></article-categories><title-group><article-title>Конкурирующие алгоритмы поиска кратчайших путей между всеми парами вершин разреженных / плотных графов: реализация и сравнение</article-title><trans-title-group xml:lang="en"><trans-title>Competing all-pairs shortest paths algorithms for sparse / dense graphs: implementation and comparison</trans-title></trans-title-group></title-group><contrib-group><contrib contrib-type="author" corresp="yes"><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Прихожий</surname><given-names>А. А.</given-names></name><name name-style="western" xml:lang="en"><surname>Prihozhy</surname><given-names>A. A.</given-names></name></name-alternatives><bio xml:lang="ru"><p>Доктор технических наук, профессор кафедры «Программное обеспечение информационных систем и технологий» Минск</p></bio><bio xml:lang="en"><p>Doctor of Science, full professor at Computer and system software department&#13;
Minsk</p></bio><email xlink:type="simple">prihozhy@bntu.by</email><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author" corresp="yes"><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Карасик</surname><given-names>О. Н.</given-names></name><name name-style="western" xml:lang="en"><surname>Karasik</surname><given-names>O. N.</given-names></name></name-alternatives><bio xml:lang="ru"><p>Кандидат технических наук, ведущий инженер Минск</p></bio><bio xml:lang="en"><p>PhD in Technical Science, is a Technology Lead</p></bio><email xlink:type="simple">karasik.oleg.nikolaevich@gmail.com</email><xref ref-type="aff" rid="aff-2"/></contrib></contrib-group><aff-alternatives id="aff-1"><aff xml:lang="ru"><institution>Белорусский национальный технический университет</institution><country>Беларусь</country></aff><aff xml:lang="en"><institution>Belarus National Technical University</institution><country>Belarus</country></aff></aff-alternatives><aff-alternatives id="aff-2"><aff xml:lang="ru"><institution>ИССОФТ СОЛЮШЕНЗ</institution><country>Беларусь</country></aff><aff xml:lang="en"><institution>ISsoft Solutions</institution><country>Belarus</country></aff></aff-alternatives><pub-date pub-type="collection"><year>2024</year></pub-date><pub-date pub-type="epub"><day>26</day><month>12</month><year>2024</year></pub-date><volume>0</volume><issue>4</issue><fpage>4</fpage><lpage>12</lpage><permissions><copyright-statement>Copyright &amp;#x00A9; Прихожий А.А., Карасик О.Н., 2024</copyright-statement><copyright-year>2024</copyright-year><copyright-holder xml:lang="ru">Прихожий А.А., Карасик О.Н.</copyright-holder><copyright-holder xml:lang="en">Prihozhy A.A., Karasik O.N.</copyright-holder><license xml:lang="ru" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>Данная работа распространяется под лицензией Creative Commons Attribution 4.0.</license-p></license><license xml:lang="en" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>This work is licensed under a Creative Commons Attribution 4.0 License.</license-p></license></permissions><self-uri xlink:href="https://sapi.bntu.by/jour/article/view/700">https://sapi.bntu.by/jour/article/view/700</self-uri><abstract><p>В статье рассматриваются два семейства конкурирующих алгоритмов поиска кратчайших путей между всеми парами вершин (APSP) в ориентированных взвешенных больших графах с различной плотностью ребер: Дейкстры и Флойда-Уоршелла. Для сравнения мы взяли алгоритм Дейкстры с динамически изменяемой двоичной кучей, который решает задачу APSP чисто параллельно путем многократного выполнения на всех вершинах графа, рассматриваемых в качестве исходных, и взяли блочный алгоритм Флойда-Уоршелла, который также является хорошо распараллеливаемым. Известно, что с точки зрения вычислительной сложности первый алгоритм предпочтительнее на разреженных графах, а второй – на плотных. В то же время неясно, каковы диапазоны плотностей графов, при которых первый алгоритм будет потреблять процессорное время, меньшее, чем второй алгоритм. В статье описаны реализации многопоточных параллельных алгоритмов на многоядерных процессорах, которые по-разному используют такие примитивы синхронизации, как мьютекс, условная переменная, блокировка и атомарная операция. Проведя вычислительные эксперименты на 8-ядерном процессоре Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz, мы обнаружили, что каждый алгоритм имеет предпочтительную плотность графов. В случае многопоточной параллельной реализации блочный алгоритм Флойда-Уоршелла имеет меньшее время работы, чем алгоритм Дейкстры, если плотность графа больше 0,5. В противном случае алгоритм Дейкстры работает быстрее. В случае однопоточной реализации точка разделения – 0,43.</p></abstract><trans-abstract xml:lang="en"><p>In this paper we consider two families of competing algorithms for finding the shortest paths between all pairs of vertices (APSP) in directed weighted large graphs with different edge densities: Dijkstra and Floyd-Warshall. For comparison, we have taken Dijkstra's algorithm with dynamically varying binary heap, which solves the APSP problem purely in parallel by repeatedly executing on all vertices of the graph considered as source vertices, and we have taken blocked Floyd-Warshall algorithm, which is also well-parallelizable. It is known that in terms of computational complexity, the first algorithm is preferable on sparse graphs and the second algorithm is preferable on dense graphs. At the same time, it is not clear what are the ranges of graph densities at which the first algorithm will consume less CPU time than the second algorithm. This paper describes multithreaded implementations of parallel algorithms on multicore processors that make different usage of synchronization primitives such as mutex, conditional variable, locking, and atomic operation. By conducting computational experiments on an 8-core Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz, we found that each algorithm has a preferred graph density. In the case of multithreaded parallel implementation, the blocked Floyd-Warshall algorithm has lower running time than Dijkstra's algorithm if the graph density is greater than 0.5. Otherwise, Dijkstra's algorithm runs faster. In the case of single-threaded implementation, the split point is 0.43.</p></trans-abstract><kwd-group xml:lang="ru"><kwd>разреженный граф</kwd><kwd>плотный граф</kwd><kwd>задача APSP</kwd><kwd>алгоритмы семейства Дейкстры</kwd><kwd>алгоритмы семейства Флойда-Уоршелла</kwd><kwd>многоядерный процессор</kwd><kwd>многопоточная реализация</kwd><kwd>сравнение</kwd></kwd-group><kwd-group xml:lang="en"><kwd>sparse graph</kwd><kwd>dense graph</kwd><kwd>APSP problem</kwd><kwd>Dijkstra-family algorithms</kwd><kwd>Floyd-Warshall family algorithms</kwd><kwd>multi-core processor</kwd><kwd>muti-threaded implementation</kwd><kwd>comparison</kwd></kwd-group></article-meta></front><back><ref-list><title>References</title><ref id="cit1"><label>1</label><citation-alternatives><mixed-citation xml:lang="ru">Madkour A., Aref W.G., Rehman F.U., Rahman M.A., Basalamah S. A Survey of Shortest-Path Algorithms. ArXiv: 1705.02044v1 [cs.DS], 4 May 2017, 26 p.</mixed-citation><mixed-citation xml:lang="en">Madkour A., Aref W.G., Rehman F.U., Rahman M.A., Basalamah S. A Survey of Shortest-Path Algorithms. ArXiv: 1705.02044v1 [cs.DS], 4 May 2017, 26 p.</mixed-citation></citation-alternatives></ref><ref id="cit2"><label>2</label><citation-alternatives><mixed-citation xml:lang="ru">Dijkstra E.W. A note on two problems in connexion with graphs. Numerische Mathematik, 1959, vol. 1, no. 1, pp. 269-271.</mixed-citation><mixed-citation xml:lang="en">Dijkstra E.W. A note on two problems in connexion with graphs. Numerische Mathematik, 1959, vol. 1, no. 1, pp. 269-271.</mixed-citation></citation-alternatives></ref><ref id="cit3"><label>3</label><citation-alternatives><mixed-citation xml:lang="ru">Bellman R.E. On a routing problem. Quarterly of Applied Mathematics, 1958, vol. 16, no. 1, pp. 87-90.</mixed-citation><mixed-citation xml:lang="en">Bellman R.E. On a routing problem. Quarterly of Applied Mathematics, 1958, vol. 16, no. 1, pp. 87-90.</mixed-citation></citation-alternatives></ref><ref id="cit4"><label>4</label><citation-alternatives><mixed-citation xml:lang="ru">Johnson D.B. Efficient Algorithms for Shortest Paths in Sparse Networks. J. ACM, 1977, vol. 24, no. 1, pp. 1-13.</mixed-citation><mixed-citation xml:lang="en">Johnson D.B. Efficient Algorithms for Shortest Paths in Sparse Networks. J. ACM, 1977, vol. 24 no. 1, pp. 1-13.</mixed-citation></citation-alternatives></ref><ref id="cit5"><label>5</label><citation-alternatives><mixed-citation xml:lang="ru">Harish P., Narayanan P.J. Accelerating large graph algorithms on the GPU using CUDA. International conference on high-performance computing. Springer, 2007, pp. 197-208.</mixed-citation><mixed-citation xml:lang="en">Harish P., Narayanan P.J. Accelerating large graph algorithms on the GPU using CUDA. International conference on high-performance computing. Springer, 2007, pp. 197-208.</mixed-citation></citation-alternatives></ref><ref id="cit6"><label>6</label><citation-alternatives><mixed-citation xml:lang="ru">Floyd R.W. Algorithm 97: Shortest path. Communications of the ACM, 1962, no. 5 (6), p. 345.</mixed-citation><mixed-citation xml:lang="en">Floyd R.W. Algorithm 97: Shortest path. Communications of the ACM, 1962, no. 5 (6), p. 345.</mixed-citation></citation-alternatives></ref><ref id="cit7"><label>7</label><citation-alternatives><mixed-citation xml:lang="ru">Katz G.J., Kider J.T. All-pairs shortest paths for large graphs on the GPU. GH’08: Proceedings of the 23rd ACM SIGGRAPH/EUROGRAPHICS symposium on Graphics hardware. ACM, 2008, pp. 47-55.</mixed-citation><mixed-citation xml:lang="en">Katz G.J., Kider J.T. All-pairs shortest paths for large graphs on the GPU. GH’08: Proceedings of the 23rd  ACM SIGGRAPH/EUROGRAPHICS symposium on Graphics hardware. ACM, 2008, pp. 47-55.</mixed-citation></citation-alternatives></ref><ref id="cit8"><label>8</label><citation-alternatives><mixed-citation xml:lang="ru">Djidjev H., Thulasidasan S., Chapuis G., Andonov R. and Lavenier D. Efficient multi-GPU computation of all-pairs shortest paths. IEEE 28th International Parallel and Distributed Processing Symposium. IEEE, 2014, pp. 360-369.</mixed-citation><mixed-citation xml:lang="en">Djidjev H., Thulasidasan S., Chapuis G., Andonov R. and Lavenier D. Efficient multi-GPU computation of all-pairs shortest paths. IEEE 28th International Parallel and Distributed Processing Symposium. IEEE, 2014, pp. 360-369.</mixed-citation></citation-alternatives></ref><ref id="cit9"><label>9</label><citation-alternatives><mixed-citation xml:lang="ru">Venkataraman G., Sahni S., Mukhopadhyaya S. A Blocked All-Pairs Shortest Paths Algorithm. Journal of Experimental Algorithmics (JEA), 2003, vol. 8, pp. 857-874.</mixed-citation><mixed-citation xml:lang="en">Venkataraman G., Sahni S., Mukhopadhyaya S. A Blocked All-Pairs Shortest Paths Algorithm. Journal of Experimental Algorithmics (JEA), 2003, vol. 8, pp. 857-874.</mixed-citation></citation-alternatives></ref><ref id="cit10"><label>10</label><citation-alternatives><mixed-citation xml:lang="ru">Park J.S., Penner M., and Prasanna V.K. Optimizing graph algorithms for improved cache performance. IEEE Trans. on Parallel and Distributed Systems, 2004, no. 15 (9), pp. 769-782.</mixed-citation><mixed-citation xml:lang="en">Park J.S., Penner M., and Prasanna V.K. Optimizing graph algorithms for improved cache performance. IEEE Trans. on Parallel and Distributed Systems, 2004, no. 15 (9), pp. 769-782.</mixed-citation></citation-alternatives></ref><ref id="cit11"><label>11</label><citation-alternatives><mixed-citation xml:lang="ru">Yang S., Liu X., Wang Y., He X., Tan G. Fast All-Pairs Shortest Paths Algorithm in Large Sparse Graph. ICS '23: Proceedings of the 37th International Conference on Supercomputing, 2023, pp. 277–288.</mixed-citation><mixed-citation xml:lang="en">Yang S., Liu X., Wang Y., He X., Tan G. Fast All-Pairs Shortest Paths Algorithm in Large Sparse Graph. ICS '23: Proceedings of the 37th International Conference on Supercomputing, 2023, pp. 277-288.</mixed-citation></citation-alternatives></ref><ref id="cit12"><label>12</label><citation-alternatives><mixed-citation xml:lang="ru">Прихожий А.А., Карасик О.Н. Усовершенствованный разнородный блочно-параллельный алгоритм поиска кратчайших путей на графе. Труды БГТУ. Сер. 3, Физико-математические науки и информатика, 2023, № 1 (266), с. 77-83.</mixed-citation><mixed-citation xml:lang="en">Prihozhy А.А., Karasik O.N. Advanced heterogeneous block-parallel all-pairs shortest path algorithm. Proceedings of BSTU, issue 3, Physics and Mathematics. Informatics, 2023, no. 1 (266), pp. 77-83.</mixed-citation></citation-alternatives></ref><ref id="cit13"><label>13</label><citation-alternatives><mixed-citation xml:lang="ru">Прихожий А.А., Карасик О.Н. Новые блочные алгоритмы поиска кратчайших путей между всеми парами вершин графа, работающие на блоках неравных размеров. Системный анализ и прикладная информатика. 2023, № 4, с. 4-13.</mixed-citation><mixed-citation xml:lang="en">Prihozhy A.A., Karasik O.N. New blocked all-pairs shortest paths algorithms operating on blocks of unequal sizes. System analysis and applied information science, 2023, no. 4, pp. 4-13.</mixed-citation></citation-alternatives></ref><ref id="cit14"><label>14</label><citation-alternatives><mixed-citation xml:lang="ru">Карасик О.Н., Прихожий А.А. Блочный алгоритм поиска кратчайших путей между всеми парами вершин в графах со слабосвязанными кластерами. Системный анализ и прикладная информатика. 2024, № 2, с. 4-10.</mixed-citation><mixed-citation xml:lang="en">Karasik O.N., Prihozhy A.A. Blocked algorithm of finding all-pairs shortest paths in graphs divided into weakly connected clusters. System analysis and applied information science, 2024, no. 2, pp. 4-10.</mixed-citation></citation-alternatives></ref><ref id="cit15"><label>15</label><citation-alternatives><mixed-citation xml:lang="ru">Prihozhy А.A., Karasik O.N. Inference of shortest path algorithms with spatial and temporal locality for big data processing. Big Data and Advanced Analytics: сборник научный статей VIII Международной научно-практической конференции, Минск, 11-12 мая 2022 года. Минск, БГУИР, 2022, с. 56-66.</mixed-citation><mixed-citation xml:lang="en">Prihozhy А.A., Karasik O.N. Inference of shortest path algorithms with spatial and temporal locality for big data processing. Big Data and Advanced Analytics: proceedings of VIII international conference. Minsk, Bestprint Publ., 2022, pp. 56-66.</mixed-citation></citation-alternatives></ref><ref id="cit16"><label>16</label><citation-alternatives><mixed-citation xml:lang="ru">Карасик О.Н., Прихожий А.А. Настройка блочно-параллельного алгоритма поиска кратких путей на эф-фективную многоядерную реализацию. Системный анализ и прикладная информатика. 2022, № 3, с. 57-65.</mixed-citation><mixed-citation xml:lang="en">Karasik O.N., Prihozhy A.A. Tuning block-parallel all-pairs shortest path algorithm for efficient multi-core implementation. System analysis and applied information science, 2022, no. 3, pp. 57-65.</mixed-citation></citation-alternatives></ref><ref id="cit17"><label>17</label><citation-alternatives><mixed-citation xml:lang="ru">Прихожий А.А. Генерация потоковых сетей акторов поиска кратчайших путей для параллельной многоядерной реализации. Информатика, 2023, № 2, с. 65-84.</mixed-citation><mixed-citation xml:lang="en">Prihozhy A.A. Generation of shortest path search dataflow networks of actors for parallel multicore implementation. Informatics, 2023, vol. 20, no. 2, pp. 65-84.</mixed-citation></citation-alternatives></ref><ref id="cit18"><label>18</label><citation-alternatives><mixed-citation xml:lang="ru">Прихожий А.А. Оптимизация размещения данных в иерархической памяти для блочных алгоритмов поиска кратчайших путей. Системный анализ и прикладная информатика, 2021, no. 3, с. 40-50.</mixed-citation><mixed-citation xml:lang="en">Prihozhy A.A. Optimization of data allocation in hierarchical memory for blocked shortest paths algorithms. System analysis and applied information science, 2021, no. 3, pp. 40-50.</mixed-citation></citation-alternatives></ref><ref id="cit19"><label>19</label><citation-alternatives><mixed-citation xml:lang="ru">Прихожий А.А. Моделирование кэш прямого отображения и ассоциативных кэш на алгоритмах поиска кратчайших путей на графе. Системный анализ и прикладная информатика, 2019, no. 4, с. 10-18.</mixed-citation><mixed-citation xml:lang="en">Prihozhy A.A. Simulation of direct mapped, k-way and fully associative cache on all-pairs shortest paths algorithms. System analysis and applied information science, 2019, no. 4, pp. 10-18.</mixed-citation></citation-alternatives></ref><ref id="cit20"><label>20</label><citation-alternatives><mixed-citation xml:lang="ru">Прихожий А.А., Карасик О.Н. Влияние алгоритмов поиска кратчайших путей на энергопотребление многоядерных процессоров. Системный анализ и прикладная информатика, 2023, № 2, с. 4-12.</mixed-citation><mixed-citation xml:lang="en">Prihozhy A.A., Karasik O.N. Influence of shortest path algorithms on energy consumption of multi-core processors. System analysis and applied information science, 2023, no. 2, pp. 4-12.</mixed-citation></citation-alternatives></ref></ref-list><fn-group><fn fn-type="conflict"><p>The authors declare that there are no conflicts of interest present.</p></fn></fn-group></back></article>
