Commit 44e3d526 authored by KitaitiMakoto's avatar KitaitiMakoto

Add dijkstra.rs

parent 8803e5d1
struct Edge<'a> {
dest: &'a Node<'a>,
cost: usize,
}
struct Node<'a> {
edges: Vec<&'a Edge<'a>>,
solved: bool,
label: &'a str,
}
impl Node<'_> {
fn new<'a>(label: &'a str) -> Node<'a> {
Node {
edges: Vec::new(),
solved: false,
label,
}
}
fn add_edge_to<'a>(&self, dest: &'a Node, cost: usize) {
let edge = &Edge {dest, cost};
self.edges.push(&edge);
}
}
struct Graph<'a> {
nodes: Vec<&'a Node<'a>>,
}
pub fn run() -> Result<(), ()> {
Ok(())
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment