dijkstra.rs 560 Bytes
Newer Older
KitaitiMakoto's avatar
KitaitiMakoto committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
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>>,
}

KitaitiMakoto's avatar
KitaitiMakoto committed
31 32 33
pub fn run() -> Result<(), ()> {
    Ok(())
}