mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
Remove live code & console.log, leave examples as comments (Geometry, Graphs, Maths).
This commit is contained in:
@ -47,30 +47,30 @@ function djikstra (graph, V, src) {
|
||||
return dist
|
||||
}
|
||||
|
||||
const V = 9
|
||||
const E = [
|
||||
[0, 1, 4],
|
||||
[0, 7, 8],
|
||||
[1, 7, 11],
|
||||
[1, 2, 8],
|
||||
[7, 8, 7],
|
||||
[6, 7, 1],
|
||||
[2, 8, 2],
|
||||
[6, 8, 6],
|
||||
[5, 6, 2],
|
||||
[2, 5, 4],
|
||||
[2, 3, 7],
|
||||
[3, 5, 14],
|
||||
[3, 4, 9],
|
||||
[4, 5, 10]
|
||||
]
|
||||
export { createGraph, djikstra }
|
||||
|
||||
const graph = createGraph(V, E)
|
||||
const distances = djikstra(graph, V, 0)
|
||||
// const V = 9
|
||||
// const E = [
|
||||
// [0, 1, 4],
|
||||
// [0, 7, 8],
|
||||
// [1, 7, 11],
|
||||
// [1, 2, 8],
|
||||
// [7, 8, 7],
|
||||
// [6, 7, 1],
|
||||
// [2, 8, 2],
|
||||
// [6, 8, 6],
|
||||
// [5, 6, 2],
|
||||
// [2, 5, 4],
|
||||
// [2, 3, 7],
|
||||
// [3, 5, 14],
|
||||
// [3, 4, 9],
|
||||
// [4, 5, 10]
|
||||
// ]
|
||||
|
||||
// const graph = createGraph(V, E)
|
||||
// const distances = djikstra(graph, V, 0)
|
||||
|
||||
/**
|
||||
* The first value in the array determines the minimum distance and the
|
||||
* second value represents the parent node from which the minimum distance has been calculated
|
||||
*/
|
||||
|
||||
console.log(distances)
|
||||
|
Reference in New Issue
Block a user