anvaka / anvaka/ngraph.path

Unable to use blocked and distance

Open
#41 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.1k
Forks
192
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the ngraphPath.aStar entry point and reproduce the issue with the graph and blocked/distance callbacks shown here. Trace why the wheelchair=false link is still considered; done means the returned path excludes that link while still using the supplied weights.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.