Add fibonacci_heap implementation

This commit is contained in:
hal8174 2024-02-24 17:11:37 +01:00
parent 6cbb389ee7
commit d2c1e6d422
6 changed files with 303 additions and 187 deletions

View file

@ -1,7 +1,9 @@
use crate::graph::wheighted_graph::shortest_path::dijkstra;
use crate::graph::wheighted_graph::WheightedGraph;
use crate::misc::Map;
use crate::priority_queue::BinaryHeap;
use crate::{
graph::wheighted_graph::shortest_path::dijkstra, priority_queue::fibonacci_heap::FibonacciHeap,
};
use std::ops::Index;
use termcolor::{Color, ColorSpec};
@ -208,7 +210,7 @@ impl Problem {
for i in 0..self.start.len() {
self.calculate_wheights(i);
let m = MapInternal { map: &self.map };
let p = dijkstra::<MapInternal, BinaryHeap<_>>(&m, self.start[i], self.end[i]);
let p = dijkstra::<MapInternal, FibonacciHeap<_>>(&m, self.start[i], self.end[i]);
if let Some(p) = p {
self.path[i] = p;