ngraph.path
ngraph.path copied to clipboard
Unable to use blocked and distance
When I create a pathfinder that uses both blocked and distance, the blocked always gets ignored. Am I doing something wrong?
graph.addLink("shopA","liftA",{weight:10, wheelchair: true});
graph.addLink("liftA","liftB",{weight:1, wheelchair: true});
graph.addLink("liftB","shopB",{weight:10, wheelchair: true});
graph.addLink("shopA","stairsA",{weight:5, wheelchair: true});
graph.addLink("stairsA","stairsB",{weight:1, wheelchair: false});
graph.addLink("stairsB","shopB",{weight:5, wheelchair: true});
let pathFinder_wc = ngraphPath.aStar(graph, {
blocked(fromNode, toNode, link) {
return !link.data.wheelchair;
},
distance(fromNode, toNode, link) {
return link.data.weight;
},
});
let path = pathFinder_wc.find("shopA","shopB");
path always returns the shortest regardless of stairsA -> stairsB is wheelchair false
Can you please confirm version of the ngraph.path library? blocked was added just recently by @bemisguided and if you still have an older version - you might not have it.
If indeed you have the latest version - what happens when you set a breakpoint in the blocked callback?