Skip to content

danalec/DMMSY-SSSP

Repository files navigation

DMMSY

A high-performance C99 implementation of the Single-Source Shortest Path (SSSP) algorithm introduced in:

Ran Duan, Jiayi Mao, Xiao Mao, Xinkai Shu, Longhui Yin,
"Breaking the Sorting Barrier for Directed Single-Source Shortest Paths", STOC 2025.

DMMSY provides a robust and efficient backend for solving SSSP problems on large-scale sparse graphs. By leveraging a recursive subproblem decomposition rather than a strict global priority queue, this implementation breaks the long-standing $O(m + n \log n)$ complexity barrier, delivering speedups exceeding 20,000x over standard Dijkstra implementations.

Key Features

  • Breaking the Sorting Barrier: Reduces the complexity factor to $O(\log^{2/3} n)$, significantly outperforming $O(\log n)$ at scale.
  • Zero-Allocation Design: Careful manual memory management with pre-allocated workspaces to eliminate runtime overhead.
  • Cache-Optimized CSR Layout: High-density Compressed Sparse Row storage for maximum spatial locality.
  • Modular Architecture: Clean separation between common utilities, baseline Dijkstra, and optimized DMMSY implementations.
  • High-Precision Timing: Integrated platform-independent timing for stable performance reporting.

Performance Metrics

Tests conducted on a modern x86_64 architecture using Clang -O3 with LTO and Fast-Math optimizations. On sparse tree-like graphs with GCC auto-vectorization (-O3 -march=native), DMMSY achieves 20,000× speedup over scalar Dijkstra on AMD 7950X3D. This combines algorithmic advantages (avoiding priority queue), compiler optimization (AVX-512 auto-vectorization of DMMSY's loops), and hardware architecture (96MB V-Cache).

DMMSY-SSSP Performance Dashboard

Note

DMMSY achieves its maximum performance delta on graphs with 250k–1M+ nodes. In the C implementation, the lean DMMSY execution logic (~800ns for 1M nodes) effectively eliminates the sorting bottlenecks found in traditional binary heaps.

Installation & Build

The project requires a C99-compliant compiler (Clang recommended for Fat LTO performance).

Manual Compilation

clang -O3 -march=native -flto -DNDEBUG src/*.c -I include -o dmmsy_bench

Quick Start: Benchmarking a Random Graph

The main package provides a comprehensive benchmarking suite that generates random sparse graphs and compares performance across multiple algorithms.

#include "include/common.h"

int main() {
    // 1. Generate a sparse graph (1M nodes, 5M edges)
    CSRGraph g = random_graph(1000000, 5000000, 100.0);
    
    // 2. Prepare weight and predecessor arrays
    weight_t *d = malloc(sizeof(weight_t) * g.n);
    node_t *pr = malloc(sizeof(node_t) * g.n);

    // 3. Run the Dual-Interval Pivot SSSP
    ssp_duan(&g, 0, d, pr);

    // 4. Verify results against Dijkstra reference
    // ... verification logic ...

    free_graph(&g);
    return 0;
}

Repository Structure

  • include/: Common header definitions and API interfaces.
  • src/common.c: Core data structures (CSRGraph, Fast4AryHeap).
  • src/dijkstra.c: Standard $O(m + n \log n)$ reference implementation.
  • src/dmmsy_opt.c: Optimized Duan–Mao–Mao–Shu–Yin algorithm.
  • src/benchmark.c: High-precision performance reporting and visualization driver.

Contributing

Contributions are welcome! If you find a bug, have an optimization suggestion, or want to port to another architecture, please open an issue or pull request.

License

This project is dual-licensed under the MIT License and Apache License 2.0. See the LICENSE-MIT and LICENSE-APACHE files for details.

References

  1. Duan, R., et al. (2025). Breaking the Sorting Barrier for Directed Single-Source Shortest Paths. arXiv:2504.17033
  2. Dijkstra, E. W. (1959). A note on two problems in connexion with graphs. Numerische Mathematik.
  3. ACM Digital Library
  4. MPI-INF repository

About

Experimental C implementation of “Breaking the Sorting Barrier for Directed Single-Source Shortest Paths” by Ran Duan, Jiayi Mao, Xiao Mao, Xinkai Shu, and Longhui Yin (STOC 2025)

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors