15 lines
320 B
Plaintext
15 lines
320 B
Plaintext
load(graphs)$
|
|
g: create_graph([[1, "a"], [2, "b"], [3, "c"], [4, "d"], [5, "e"], [6, "f"]],
|
|
[[[1, 2], 7],
|
|
[[1, 3], 9],
|
|
[[1, 6], 14],
|
|
[[2, 3], 10],
|
|
[[2, 4], 15],
|
|
[[3, 4], 11],
|
|
[[3, 6], 2],
|
|
[[4, 5], 6],
|
|
[[5, 6], 9]], directed)$
|
|
|
|
shortest_weighted_path(1, 5, g);
|
|
/* [26, [1, 3, 4, 5]] */
|