Expand description
§Mgraph
mgraph is a simple, fast, performace-oriented graph library for Rust. It’s being contributed to on daily basis and grows fast!
§Features
Features that are implemented already:
- DFS algorithm
- BFS algorithm
- Dijkstra shortest path algorithm
- Serialization and deserialization of graphs
Features that are to be implemented in future:
- A* algorithm
- Other intresting things of graph theory, such as different search algorithms, sorting algorithms etc.
§Example usage
let mut graph = mgraph::Graph::new();
graph.add_node(0);
graph.add_node(1);
graph.add_node(2);
graph.add_node(3);
graph.add_edge(0, 1, 6);
graph.add_edge(0, 2, 16);
graph.add_edge(1, 2, 7);
graph.add_edge(2, 3, 8);
let result = graph.shortest_path(0, 2);
let parents = result.parents.unwrap();
let cost = result.cost.unwrap();
println!("{:#?}\n\n{:?}", cost, parents);
let shortest_path = graph.restore_path(0, 2, parents);
Structs§
- Dijkstra
Result - DijkstraResult structure contains shortest path algorithm return values
- Graph
- Graph data structure