0

Here is a problem that can be modeled using a directed graph with different costs on each edge.
Our input is an array of edges.
const edges = [['A', 'B', 20], ['B', 'C', 10], ['A', 'C', 50], ['B', 'D', 5], ['D', 'C', 2]]
['A', 'B', 20], meaning that from A to B the cost is 20. I wanted to write ...