andrewhayward / dijkstra Goto Github PK
View Code? Open in Web Editor NEWA JavaScript implementation of Dijkstra's algorithm
License: MIT License
A JavaScript implementation of Dijkstra's algorithm
License: MIT License
thank you for your code, i just want to ask you if we have a node which go to more than two nodes for example : node a go to b, c, d, e. is it possible to set our map like that:
var map = {a:{b:1,c:3,d:2,e:5},
....
....
}
On line 73 of graph.js, there is
predecessor = predecessors[u];
predecessor is not predefined so it ends up in the global scope. I'm not quite sure what it's supposed to do in the first place considering it's not used anywhere.
What's this code's licence ?
Poor description. The cod also does not work. There is no way to dynamically set keys for objects in javascript . I guess that a map function must be used t0 produce that weird crazy structure for an adjacency matrix
Hi andrew, thanks for this code.
There's a way to implement this structure:
var map = [
{
node: 'a',
next: [
{
id: 'b',
weigth: 3
},
{
id: 'c',
weigth: 1
}
]
}, {
node: 'b',
next: [
{
id: 'a',
weigth: 2
},
{
id: 'c',
weigth: 1
}
]
}, {
node: 'c',
next: [
{
id: 'a',
weigth: 4
},
{
id: 'd',
weigth: 2
}
]
}, {
node: 'd',
next: []
}
]
instead of
var map = {
a: {
b: 3,
c: 1
},
b: {
a: 2,
c: 1
},
c: {
a: 4,
b: 1
},
d: {}
}
I ask you this because i have some nodes with alphanumeric string (e.g. 145EMA3) and the JS notation not allow the number into object key.
Hello Andrew,
I would like to use your dijkstra algorithm for the underground but I face some problems :
Could you give me a simple sample ?
I looked for weeks but didn't find anything.
Many thanks
Maybe you can output the result as an array include:
[Route, WeightInTotal]
just added up the weight. that's really helpful
Duh, nvm
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.