Git Product home page Git Product logo

liu-xiandong / fastapsp Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 1.72 MB

The Fast APSP algorithm is used to solve the All-Pairs Shortest Paths (APSP) problem. The algorithm uses the divide and conquers strategy. First, divide the graph structure by METIS, and divide the input graph G into multiple subgraphs. Then the solution of the APSP problem is solved by computing the subgraph. The Fast APSP algorithm combines the SSSP algorithm and the Floyd-Warshall algorithm. Compared with the Part APSP algorithm, it eliminates the data dependence and communication between sub-graphs. The Fast APSP algorithm has achieved good performance in graphs with good properties. We tested a lot of sparse graph data in the Suite sparse matrix collection and network repository, and the Fast APSP algorithm showed better performance than other APSP algorithms.

Python 6.87% Shell 0.19% C++ 66.28% Cuda 22.83% C 2.56% CMake 1.27%
apsp graph graph-algorithms

fastapsp's Introduction

Fast-APSP

The Fast APSP algorithm is used to solve the All-Pairs Shortest Paths (APSP) problem. The algorithm uses the divide and conquers strategy. First, divide the graph structure by METIS, and divide the input graph G into multiple subgraphs. Then the solution of the APSP problem is solved by computing the subgraph. The Fast APSP algorithm combines the SSSP algorithm and the Floyd-Warshall algorithm. Compared with the Part APSP algorithm, it eliminates the data dependence and communication between sub-graphs. The Fast APSP algorithm has achieved good performance in graphs with good properties. The algorithm diagram is as follows.

We tested a lot of sparse graph data in the Suite sparse matrix collection and network repository, and the Fast APSP algorithm showed better performance than other APSP algorithms.

Dependency

  • g++ 7.50
  • METIS 5.1.0
  • cuda 10.1
  • Openmpi 4.0.2

Quickstart

mkdir build
cd build
cmake ..

Usage

Here are the basic usages of Fast APSP.

./EXE -f <graph> [options]

[-f] Choose a graph which must in ./graph directory

[-direct] Whether the input graph is a directed graph (DeFault: false)

[-weight] Whether the input graph is a weighted graph (DeFault: false)

[-k] Number of graph divisions

The following interface code is performed.

#include "fap/fap.h"

fap::fapGraph G(file, directed, weighted, K);
G.preCondition();
if (G.isSplit()) {
    G.solveSubGraph(1, true);  // Solve the first subgraph.
} else {
    G.solve();  // Solve all subgraphs.
}

Example

Here is a sample codes of APSP for graph luxembourg_osm.

run with ./singleNodeExample -f luxembourg_osm -k 128 -direct false -weight false:

Cite Us

If you use our library, please cite our research paper.

@inproceedings{yang2023fast,
  title={Fast All-Pairs Shortest Paths Algorithm in Large Sparse Graph},
  author={Yang, Shaofeng and Liu, Xiandong and Wang, Yunting and He, Xin and Tan, Guangming},
  booktitle={Proceedings of the 37th International Conference on Supercomputing},
  pages={277--288},
  year={2023}
}

License

All the libraryies, examples, and source codes of Fast APSP are released under Apache 2.0.

fastapsp's People

Contributors

liu-xiandong avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.