Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
pm="apt"
action="install"
$sudo = "sudo"
install() {
$sudo $pm $action $1
}
install "make" &
@DIvkov575
DIvkov575 / graph.rs
Created March 10, 2023 00:19
directed weighted graph in rust nodes/weights
let W = HashMap::from([
(0, Vec::from([4,3,2)),
(1, Vec::from([5,6])),
(2, Vec::from([7,9])),
(3, Vec::from([3,3])),
(4, Vec::from([5,4])),
(5, Vec::from([])),
(6, Vec::from([])),
(7, Vec::from([]))
]);
@DIvkov575
DIvkov575 / graph.rs
Last active August 31, 2023 17:34
directed weighted graph implemented in rust w/ edge struct
pub struct E {
weight: i32,
node: i32,
}
#[allow(non_snake_case)]
let G: Vec<Vec<E>> = Vec::from([
Vec::from([E { node: 1, weight: 4 }, E { node: 2, weight: 3 }, E { node: 3, weight: 2 }]),
Vec::from([E { node: 2, weight: 5 }, E { node: 3, weight: 6 }]),
Vec::from([E { node: 4, weight: 7 },E { node: 6, weight: 9 }]),