switch to NodePointer alias
parent
876aa735dc
commit
3d14f3b3e1
|
@ -9,20 +9,19 @@ use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
collections::{hash_map::Entry, HashMap},
|
collections::{hash_map::Entry, HashMap},
|
||||||
env,
|
env,
|
||||||
f64::INFINITY,
|
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
};
|
};
|
||||||
|
|
||||||
use parse::Record;
|
use parse::Record;
|
||||||
|
|
||||||
type Graph = HashMap<usize, Rc<RefCell<Node>>>;
|
type NodePointer = Rc<RefCell<Node>>;
|
||||||
|
type Graph = HashMap<usize, NodePointer>;
|
||||||
type Airports = HashMap<usize, Rc<airport::Airport>>;
|
type Airports = HashMap<usize, Rc<airport::Airport>>;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct Node {
|
struct Node {
|
||||||
origin: Rc<airport::Airport>,
|
origin: Rc<airport::Airport>,
|
||||||
destinations: Vec<Destination>,
|
destinations: Vec<Destination>,
|
||||||
source_distance: f64,
|
|
||||||
visited: bool,
|
visited: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +30,6 @@ impl Node {
|
||||||
Node {
|
Node {
|
||||||
destinations,
|
destinations,
|
||||||
origin,
|
origin,
|
||||||
source_distance: INFINITY,
|
|
||||||
visited: false,
|
visited: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +37,7 @@ impl Node {
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct Destination {
|
struct Destination {
|
||||||
node: Rc<RefCell<Node>>,
|
node: NodePointer,
|
||||||
distance: f64,
|
distance: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue