-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(algorithms): implement dijkstra's
- Loading branch information
1 parent
5086451
commit 8a1f9a8
Showing
7 changed files
with
400 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
paths: | ||
- '**.rs' | ||
- 'src/**.rs' | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: | ||
- '**.rs' | ||
- 'src/**.rs' | ||
|
||
env: | ||
CI: true | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
test: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install tarpaulin | ||
run: cargo install cargo-tarpaulin | ||
- name: Run build | ||
run: cargo build | ||
- name: Run clippy | ||
run: cargo clippy --all-targets --all-features --no-deps -- -D warnings | ||
- name: Run lint | ||
run: cargo fmt -- --check | ||
- name: Run tests | ||
run: cargo tarpaulin --out xml | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
with: | ||
file: ./cobertura.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,11 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
# RustRover | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ | ||
.env | ||
/.idea | ||
/.vscode | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "graph-algorithms-rs" | ||
description = "A collection of graph algorithms." | ||
version = "1.0.0" | ||
edition = "2021" | ||
license = "MIT" | ||
readme = "README.md" | ||
authors = ["Slavik Pastushenko <slavpas@gmail.com>"] | ||
repository = "https://github.com/slavik-pastushenko/graph-algorithms-rs" | ||
|
||
[lib] | ||
name = "graph_algorithms" | ||
path = "src/lib.rs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,66 @@ | ||
# graph-algorithms-rs | ||
# Graph Algorithms in Rust | ||
|
||
A collection of graph algorithms implemented in Rust. This repository aims to provide efficient and easy-to-understand implementations of various graph algorithms for educational purposes and practical use. | ||
|
||
Contributions are welcome to expand the set of algorithms and improve existing implementations. | ||
|
||
## Reference implementation | ||
|
||
[![test](https://github.com/slavik-pastushenko/graph-algorithms-rs/actions/workflows/test.yml/badge.svg)](https://github.com/slavik-pastushenko/graph-algorithms-rs/actions/workflows/test.yml) | ||
[![codecov](https://codecov.io/gh/slavik-pastushenko/graph-algorithms-rs/graph/badge.svg?token=9EL0F6725A)](https://codecov.io/gh/slavik-pastushenko/graph-algorithms-rs) | ||
|
||
### Algorithms | ||
|
||
### Dijkstra's Algorithm | ||
Dijkstra's algorithm finds the shortest path from a starting node to all other nodes in a weighted graph. It uses a priority queue to efficiently select the next node with the smallest distance. | ||
|
||
### A* Algorithm (TODO) | ||
A* is a pathfinding and graph traversal algorithm that is often used in many fields of computer science due to its completeness, optimality, and optimal efficiency. | ||
|
||
### Breadth-First Search (BFS) (TODO) | ||
BFS explores the graph level by level, starting from a given node. It is used for finding the shortest path in an unweighted graph. | ||
|
||
### Depth-First Search (DFS) (TODO) | ||
DFS explores as far as possible along each branch before backtracking. It is used for pathfinding and topological sorting. | ||
|
||
### Bellman-Ford Algorithm (TODO) | ||
The Bellman-Ford algorithm computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph. It can handle graphs with negative weight edges. | ||
|
||
### Floyd-Warshall Algorithm (TODO) | ||
The Floyd-Warshall algorithm finds shortest paths between all pairs of vertices in a weighted graph. It can handle graphs with negative weights but no negative weight cycles. | ||
|
||
## Safety | ||
|
||
This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in 100% safe Rust. | ||
|
||
## Contributing | ||
|
||
Build the application: | ||
|
||
```bash | ||
cargo build | ||
``` | ||
|
||
Test the application: | ||
|
||
```bash | ||
cargo test | ||
``` | ||
|
||
Run [clippy](https://github.com/rust-lang/rust-clippy): | ||
|
||
```bash | ||
cargo clippy --all-targets --all-features --no-deps -- -D warnings | ||
``` | ||
|
||
Run [lint](https://github.com/rust-lang/rustfmt): | ||
|
||
```bash | ||
cargo fmt | ||
``` | ||
|
||
Generate documentation in HTML format: | ||
|
||
```bash | ||
cargo doc --open | ||
``` |
Oops, something went wrong.