Move graph example to correct crate
This commit is contained in:
parent
af625cf905
commit
2f637e1a82
1 changed files with 1 additions and 1 deletions
|
|
@ -1,40 +0,0 @@
|
|||
use factorio_pathfinding::priority_queue::{fibonacci_heap::FibonacciHeap, PriorityQueue};
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn test_loop<P>()
|
||||
where
|
||||
P: PriorityQueue<u16> + Debug,
|
||||
{
|
||||
let mut input = String::new();
|
||||
|
||||
let mut p = P::new();
|
||||
|
||||
let mut handles = Vec::new();
|
||||
|
||||
loop {
|
||||
input.clear();
|
||||
let _ = std::io::stdin().read_line(&mut input);
|
||||
|
||||
let (cmd, arg) = input.trim().split_once(' ').unwrap_or((input.trim(), ""));
|
||||
// dbg!(cmd, arg);
|
||||
|
||||
match cmd {
|
||||
"i" => handles.push(p.insert(arg.parse::<u16>().unwrap())),
|
||||
"m" => println!("{:?}", p.pop_min()),
|
||||
"d" => {
|
||||
let (a, b) = arg.split_once(' ').unwrap();
|
||||
let h = &handles[a.parse::<usize>().unwrap()];
|
||||
let n = b.parse::<u16>().unwrap();
|
||||
p.decrease_key(h, |f| *f = n);
|
||||
}
|
||||
"p" => {
|
||||
dbg!(&p);
|
||||
}
|
||||
_ => println!("Unknown command."),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
test_loop::<FibonacciHeap<u16>>()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue