Initial release #1

Merged
warrence merged 102 commits from dev into main 2026-06-30 10:26:52 +02:00
Showing only changes of commit 0f5f0d67d2 - Show all commits
+6 -8
View File
@@ -92,19 +92,17 @@ where
});
while let Some(v) = heap.pop() {
for adjacent in graph.adjacent_vertices(v.vertex) {
// TODO: Use custom edge weights in Dijkstra's algorithm.
let edge_weight = 1;
let new_distance = distances[v.vertex].unwrap() + edge_weight;
if match distances[adjacent] {
for incidence in graph.incidences(v.vertex) {
let new_distance = distances[v.vertex].unwrap() + weight(incidence.1);
if match distances[incidence.0] {
None => true,
Some(old_distance) if old_distance > new_distance => true,
_ => false,
} {
distances[adjacent] = Some(new_distance);
on_relax(adjacent, v.vertex);
distances[incidence.0] = Some(new_distance);
on_relax(incidence.0, v.vertex);
heap.push(DistanceOrderedVertex {
vertex: adjacent,
vertex: incidence.0,
distance: new_distance,
});
}