tcort / dijkstrajs Goto Github PK
View Code? Open in Web Editor NEWA simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm.
License: Other
A simple JavaScript implementation of Dijkstra's single-source shortest-paths algorithm.
License: Other
First off, thank you for making the ground stone library, which is currently in use in famous libraries and utilities. I think that the usage of this library must encourage implementing the algorithm more effectively. Therefore, I created a pull request with the improvements.
Thank you.
List listaDeArestas = [[a, b], [a, h], [b, c], [b, h], [c, d], [c, f], [c, i], [d, e], [d, f], [e, f], [f, g], [g, h], [g, i], [h, i]]
List output1 = Dijkstra.findPathFromPairsList(listaDeArestas, "a", "e");
print(output1);
prints [a, b, c, d, e], but [a, b, c, f, e] is the correct
i am using it for a scenario where 2 point lead to a single room or 2 entrances of a room i need to compare shortest path for both entrances if we get the total weight of shortest path it would be really easy to compare shortest paths
The value of predecessor
(singular) is seemingly never read, only assigned.
Line 102 in b13c58e
from:
extract_shortest_path_from_predecessor_list: function(predecessors, d) {
var nodes = [];
var u = d;
var predecessor;
while (u) {
nodes.push(u);
predecessor = predecessors[u];
u = predecessors[u];
}
nodes.reverse();
return nodes;
}
If you agree, I can create a PR to remove it.
Hello Thomas, first off, thanks for the great library. Your dijkstrajs is working great.
Just one question, i'm implementing your library to multi floors pathfinding problem and, unfortunately I do not want to simply join the graphs because sometimes the path will give us transferring the floor only because they are the shortest path.
Therefore, I would like to simply go over and try to find the pah each floor and if cannot find the path, I would like to handle the error case, e.g. if...else... then..
In order to handle the case, do you know if I could detect the error 'cannot find the path...' just like promise .then and .catch chaining method?
Apology if this is not the right place to ask.
Thank you.
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.