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.
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* 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.
BFS explores the graph level by level, starting from a given node. It is used for finding the shortest path in an unweighted graph.
DFS explores as far as possible along each branch before backtracking. It is used for pathfinding and topological sorting.
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.
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.
This crate uses #![forbid(unsafe_code)]
to ensure everything is implemented in 100% safe Rust.
Build the application:
cargo build
Test the application:
cargo test
Run clippy:
cargo clippy --all-targets --all-features --no-deps -- -D warnings
Run lint:
cargo fmt
Generate documentation in HTML format:
cargo doc --open