https://github.com/tiagocavalcante/fixed-length-search
The fastest algorithm for finding a path with a specific length in a graph
https://github.com/tiagocavalcante/fixed-length-search
algorithms graph path-search-algorithm
Last synced: 10 months ago
JSON representation
The fastest algorithm for finding a path with a specific length in a graph
- Host: GitHub
- URL: https://github.com/tiagocavalcante/fixed-length-search
- Owner: TiagoCavalcante
- License: mit
- Created: 2022-08-05T01:56:23.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-10T18:38:08.000Z (over 2 years ago)
- Last Synced: 2025-01-29T11:51:11.107Z (over 1 year ago)
- Topics: algorithms, graph, path-search-algorithm
- Language: Rust
- Homepage: https://crates.io/crates/fixed-length-search
- Size: 47.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# fixed-length-search
The fastest algorithm for finding a path with a specific length in a graph
## How to run?
```sh
$ cargo install fixed-length-search
$ fixed-length-search
```
## How fast is it?
Here is the output of the benchmark of the algorithm for a graph with 10 thousand vertices and density of 0.1:
```
Fill the graph - 250.07ms
Fixed length search - 19.52ms
The path is valid
```
Yep, that is milliseconds, not seconds.
You can find a better benchmark [here](https://github.com/TiagoCavalcante/fls-bench).
## How does it work?
This is a mix of the ideas used in meet-in-the-middle search and BFS, there are lots of comments in the code that explains each aspect of this algorithm. You can find an animation that may help you to understand this algorithm [here](https://github.com/TiagoCavalcante/fls-animation).